Batch files - Examples (D*)

Download the ZIPped sources Click the floppy disk icons to download the ZIPped sources

 

Batch file examples
Download the ZIPped sources Name Description OS (1) Last modified
(DD/MM/YYYY)
Remarks
Download the ZIPped sources DateAdd Add/subtract a specified number of days to/from a specified date NT 12/02/2007 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
Download the ZIPped sources DateDiff Calculate the difference in days between two dates NT 04/06/2007 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
Download the ZIPped sources DateFmt Show the current date in the specified format NT 29/11/2007 Inspired by Simon Sheppard's GetDate.bat
Download the ZIPped sources DateTime Store week day, current date and current time in environment variables All   Take a look at SortDate and SortTime for an NT version with language independent sorting, or at DateErrT for a version that uses ErrTime by Phil Money to remain virtually OS independent
Download the ZIPped sources DDLU.bat Don't Display Last Username: clears the last user name from the login dialog box permanently. NT 20/12/2001 Use CLLUN.bat instead to remove the last logon user name just this once
Download the ZIPped sources DeadProf.bat Delete inactive corrupted profiles for current user NT 15/09/2000  
Download the ZIPped sources Dec2Hex.bat Convert a decimal number to 8 digit hexadecimal NT 08/12/2007 This batch file uses a "poorly documented" feature of the PING command to convert a decimal number to hexadecimal.
Requires FINDSTR (not native in NT 4, but part of the Resource Kit).
Also available in KiXtart, Perl, Rexx and VBScript.
Download the ZIPped sources DecToHex.bat Convert a decimal number to "7.5" digit hexadecimal NT 08/12/2007 This batch file uses CMD.EXE's internal commands only.
Also available in KiXtart, Perl, Rexx and VBScript.
Download the ZIPped sources DefOpen.bat Create a default file association to Notepad and add "Open with Notepad", "Print with Notepad" and "Command Prompt Here" options to popup menus 95 98 NT 2000 XP 21/11/2007 Based on a tip by Regedit.com.
More details on my REGEDIT page.
Download the ZIPped sources DefPRN.bat Display default printer name NT 07/11/1999 Also available as OS/2 Rexx, Windows Rexx, JScript, KiXtart, Perl and VBScript scripts
DefPRN2K.bat W2K 13/02/2002
Download the ZIPped sources DelFlash.bat Delete "Local Stored Objects", also known as "Flash Cookies", from the current user's profile NT 15/09/2007 Tested on Windows XP SP2 only. Use entirely at your own risk!
Also available in VBScript.
Download the ZIPped sources DelOutlX.bat Uninstall Outlook Express (BETA!) W2K 20/12/2003 Tested on 1 Windows 2000 computer only.
Use entirely at your own risk!
Download the ZIPped sources DelProf.bat Delete specified profile (BETA!) NT 17/12/2003 Still in beta! That is why the most destructive command of the batch file is echoed only.
Download the ZIPped sources Desktop.bat Uses SHORTCUT.EXE to save all desktop shortcuts as a batch file that can recreate those shortcuts again (Desktop backup) NT+RK 05/08/2001  
Download the ZIPped sources Disabled.bat Lists all disabled user accounts NT 21/09/2000  
  DiskFree Check amount of free disk space, the hard way All   Use FreeSpace.vbs if you need a more reliable tool
Download the ZIPped sources DiskSpc Display harddisk summary for any WMI enabled computer or for a list of computers XP 02/10/2006 Uses WMIC
Download the ZIPped sources DiskUse.bat List the disk usage for every subdirectory NT 20/12/2003 Returns negative numbers if total file sizes exceed 2GB.
Also available as Rexx script
DiskUse.bat W2K 21/12/2003 Fixed negative numbers bug for Windows 2000/XP
Download the ZIPped sources DispEDID.bat Display your monitor's EDID asset information XP 20/02/2007 Also available in VBScript
Download the ZIPped sources DllMenu.bat Add "Register" and "Unregister" to Explorer's context menu for DLLs & OCXs W2K 18/04/2007  
Download the ZIPped sources DriveRdy.bat Check if (removable) drive is ready DOS6+ OS2 18/07/1999 Also available as OS/2 Rexx script
Download the ZIPped sources Drives.bat List local drive letters and types W2K 17/12/2003  
Download the ZIPped sources DrivUsed.bat List used and available drive letters XP 30/12/2007  

 

 

Notes: (1) Operating System version these batch files were meant for
All No version specific commands are used, though it is (obviously) not tested with every DOS version available
95 Windows 95 (and probably Windows 98 as well)
98 Windows 98
DOS3 MS-DOS 3 and 4
DOS6+ MS-DOS 6 and later
Kix Windows (most functions also in plain DOS) with KiXtart
NT4 Windows NT 4 (Windows NT 4 Terminal Server Edition too)
NT Windows NT (Windows 2000 and Windows NT 4 Terminal Server Edition too)
NT+RK Windows NT with Resource Kit (Windows NT 4 Terminal Server Edition with Resource Kit too)
W2K Windows 2000, and probably XP and Server 2003 as well
W2K+RK Windows 2000 with (Server) Resource Kit, and (probably) XP and Server 2003 as well
W2K3 Windows Server 2003
XP Windows XP
OS2 OS/2 Warp
TS Windows NT 4 Terminal Server Edition, or Windows 2000 Server or Windows Server 2003 with Terminal Services