💾 Click the floppy disk or package (for third party scripts) 📦 icons to download the ZIPped sources
❔ Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPped sources
Batch file examples | ||||
---|---|---|---|---|
💾 | ❔ | Name | Description | Remarks |
💾 | ❔ | AtFuture.bat | Schedule a command a few minutes from now in the near future | This batch file was a coproduction with Rob Fuller. |
💾 | ❔ | DateAdd.bat | Add/subtract a specified number of days to/from a specified date | Use REGEDIT. Based on Fliegel-Van Flandern Julian date conversion algorithms from the Astronomical Almanac, provided by Doctor Fenton on the Math Forum and converted to batch code by Ron Bakowski. |
💾 | ❔ | DateDiff.bat | Calculate the difference in days between two dates | |
💾 | ❔ | DateFmt.bat | Show the current date in the specified format | Inspired by Simon Sheppard's GetDate.bat. |
💾 | ❔ | DatePart.cmd | Return the specified part of the current date | Uses WMIC. |
💾 | ❔ | DateTime.cmd | Return the current date as errorlevel in YYYYMMDD format | Written by Justin. Tested only in Windows XP. Requires modifications to work on non-English systems. |
💾 | ❔ | Easter.bat | Calculate dates for Easter Day, Ascension Day and Pentecost for any year | Uses REGEDIT. Easter Day algorithm found at Simon Kershaw's Keeping the Feast. Julian date conversions based on Fliegel-Van Flandern algorithms from the Astronomical Almanac, provided by Doctor Fenton on the Math Forum and converted to batch code by Ron Bakowski. |
💾 | ❔ | iDate.bat | Read the date format setting from the registry | Uses REG.EXE. |
💾 | ❔ | IsDate.bat | Tests if the specified date is a valid date | |
💾 | ❔ | IsDST.bat | Tests if the current or specified date/time is in Daylight Saving Time | Warning: Changes the system date up to 65 times, which may cause problems for domain members. Use entirely at your own risk. VBScript and C# versions are safer to use. |
📦 | ❔ | IsRTCSet.bat | Check if the CMOS Real Time Clock is set, and return an errorlevel greater than 0 if not | Uses DEBUG to read the RTC status from the CMOS. |
💾 | ❔ | iTime.bat | Read the time format setting from the registry | Uses REG.EXE. |
💾 | ❔ | LeapYear.bat | Check if the specified year is a leap year or not | Code to extract current year by Simon Sheppard. |
💾 | ❔ | Now.bat | Display the current time in HHmmss format with any delimiter you want | Uses DEBUG. |
📦 | ❔ | PMSoon.bat | Schedule at relative times instead of absolute times | A "clone" of the Windows NT 4 Server Resource Kit's SOON command using NT's native NET Time and AT commands only. |
💾 | ❔ | sDate.bat | Read the date separator (delimiter) setting from the registry | Uses REG.EXE. |
💾 | ❔ | SetDate.bat | Store the current day in an environment variable | Code is more complex than usual to allow it to be used in any NT version; as of Windows 2000 the %DATE% variable can be used instead. |
💾 | ❔ | SetTime.bat | Store the current time in an environment variable | As of Windows 2000 the %TIME% variable can be used instead. |
💾 | ❔ | SortDate.bat (2.*) | Store sorted date in variable, independent of Control Panel's "Regional Settings" | Uses REG.EXE. |
💾 | ❔ | SortDate.bat (3.*) | Uses REGEDIT. | |
💾 | ❔ | SortDate.bat (4.*) | Uses code from Simon Sheppard's GetDate.bat to convert the current date to YYYYMMDD format. This technique is not entirely language independent, though it does not depend on regional settings. |
|
💾 | ❔ | SortDate.bat (5.*) | Uses WMIC. | |
💾 | ❔ | SortTime.bat (2.*) | Store sorted time in variable, independent of Control Panel's "Regional Settings" | Uses REG.EXE. |
💾 | ❔ | SortTime.bat (3.12) | Uses REGEDIT. | |
💾 | ❔ | SortTime.bat (3.40) | Uses REGEDIT and FINDSTR. | |
💾 | ❔ | StarDate.bat | Convert current date and time to stardate | Algorithm found on The Star Trek Gallery. |
💾 | ❔ | StarDateXP.bat | Convert current date and time to stardate | Algorithm found on The Star Trek Gallery. Uses WMIC. |
💾 | ❔ | sTime.bat | Read the time separator (delimiter) setting from the registry | Uses REG.EXE. |
💾 | ❔ | Today.bat | Display the current date in DDMMYYYY or YYYYMMDD format, with any delimiter you want | Uses DEBUG. |
💾 | ❔ | TodayNow.bat | Display the current date and time in YYYYMMDDHHmmss format without any delimiters | Uses DEBUG. |
💾 | ❔ | Week.bat | Display the current week number. | Uses REGEDIT. |
💾 | ❔ | WeekXP.bat | Display the current ISO week number. | More accurate than the NT version Uses WMIC. |
💾 | ❔ | Yesterday.bat | Display yesterday's, today's and tomorrow's date in two formats | Uses REGEDIT if REG is not available. |
Notes: | Most of the following NT batch files were created and tested in Windows NT 4 and/or Windows 2000. Most of them will work or can be adapted to work in Windows XP as well. However, keep in mind that Microsoft has made some changes in the output of the DATE /T and TIME /T commands, depending on the Regional Settings used.In the Canadian English version of XP for example, DATE /T does not return the Day Of Week, only MM/DD/YY.Workaround: FOR %%A IN (%Date%) DO SET Today=%%A DIR 's time stamp uses HH:mm AM or PM in XP, instead of 2000's HH:mma or m.Workaround: That's a long story, just take a look at SortTime.bat to see how Harry Teufel and yours truly solved this. And last but not least, REG.EXE 2.0 (Windows 2000 and later), is not backwards compatible! This means that code written for earlier versions (i.e. the one from theWindows NT 4 Resource Kit) has to be modified. Sometimes you don't need to check for REG.EXE's version, just run the command twice, once for the old REG and once for the new one. This technique is demonstrated in iDate.bat, sDate.bat, iTime.bat and sTime.bat. |
page last modified: 2012-11-18; loaded in 0.0122 seconds