Batch Files: Examples

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

Checksums for the ZIPed sources Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPed sources

 

 

All 0..9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 

Batch file examples
Click the floppy disk icons to dowload the ZIPed sources Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPed sources Name Version Description OS (1) Last modified
(yyyy-mm-dd)
Remarks
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Random.bat 1.00 Generate random numbers (V1 works only with comma as decimal delimiter; fixed in V2) DOS 2000-07-07 In OS/2 Rexx or KiXtart only one single line is needed to generate random numbers, Perl needs 2 lines.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Random.bat 2.00 Generate random numbers DOS 2000-07-07 In OS/2 Rexx or KiXtart only one single line is needed to generate random numbers, Perl needs 2 lines.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Random.bat 1.00 Generate random numbers (V1 depends on US language settings, V2 for Windows 2000/XP, by Nathan Rooke, is language independent) NT 2003-08-08 In OS/2 Rexx or KiXtart only one single line is needed to generate random numbers, Perl needs 2 lines.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Random.bat 2.00 Generate random numbers (V1 depends on US language settings, V2 for Windows 2000/XP, by Nathan Rooke, is language independent) NT 2003-08-08 In OS/2 Rexx or KiXtart only one single line is needed to generate random numbers, Perl needs 2 lines.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ReadINI.bat 1.30 Read a value from an INI file NT 2007-07-31 May fail on "special" characters like & | < > and parentheses.
In version 1.20 the speed of processing has been improved by Jeroen Verschuuren.
Version 1.30 contains several improvements by Van Woods, US Army Corps of Engineers, Seattle District.
READINI is also available as KiXtart, Perl, Rexx and and VBScript scripts.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ReadReg.bat 2.10 Read a value from the registry NT 2004-10-25 Requires EGREP or FINDSTR.
May fail on "special" characters like & | < > and brackets.
Uses FINDSTR if available, or EGREP otherwise.
Also available as KiXtart, Perl, Rexx and VBScript scripts.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ReadXML.bat 1.00 Read a value from an XML file NT 2010-07-14 Requires XML Starlet
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Recycled.bat 1.00 Create or delete a shortcut to the "Recycle Bin" in your Start Menu NT 2001-09-22 The shortcut does not give you the same functionality as the original Recycle Bin, but it can be used to quickly check the properties of deleted files.
Tested in NT 4 only.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RegDLL.bat 1.01 Add Explorer menu entries to register/unregister DLLs W2K 2004-01-05 Based on an article on The Code Project website
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RemMacro 1.00 Use McAfee VirusScan to remove all macro's from MS-Office documents 95 NT 2002-03-15  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RemoteSID.bat 2.11 Shows who is logged on to a remote computer, displaying both user ID and Security ID (SID). NT 2001-11-15 Requires GETSID and PSLOGGEDON
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RenewUSB 1.00 Remove all USB devices and then rescan for new ones W2K 2004-06-11 Requires DEVCON.
You will be prompted for download if DEVCON isn't found.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RestHome   Use NT's FOR /D parameter to restore a server's home directory shares and access rights NT 2000-10-17 Also available as Rexx scripts for OS/2 LAN Server; or use ForD as a FOR /D replacement in OS/2 batch files
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ResumePrinting.bat 1.00 Resume printing on the specified printer XP 2010-07-11 Requires WMIC.
Use PausePrinting.bat to pause printing.
Also available in VBScript
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Reverse.bat 2.00 Return a string in reverse order NT 2001-08-05 See Tom Lavedas' User-to-User article for a DOS version using CHOICE.
Rexx has a built-in REVERSE() function
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RmHidDev.bat 1.00 Remove all hidden (inactive) Plug&Play devices W2K 2006-11-10 Requires DEVCON.
Written to remove "ghost devices" from Ghost images.
You will be prompted for download if DEVCON isn't found.
Warning: May cripple your OS, use entirely at your own risk, and only after making a full backup.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RmUserID.bat 0.52 Delete a user account and the associated data and share. W2K 2004-10-23 Requires Windows Server 2003's DS Tools, RMTSHARE, TAKEOWN, TSCMD and OWN.BAT
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RxAssoc.bat 2.00 Associates the REX extension with Regina Rexx executable. After executing this batch file once, you can call any *.REX directly, without the need to precede it with REXX.EXE. NT 2000-02-11 With SET PATHEXT=.REX;%PATHEXT% (better yet: set it as a global variable in Control Panel, System) you won't need to type the .REX extension to run .REX scripts.
Adapt the (hard coded) path for REXX.EXE to your own situation.
Better still, use REGINA.EXE instead of REXX.EXE.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RXDir.bat 0.50 Use Regular eXpressions in the DIR command NT 2004-10-16 Requires EGREP

 

All 0..9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 

Notes: (1) Operating System version these batch files were written 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)
W2K Windows 2000, 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
QR Code for http://www.robvanderwoude.com/batexamples.php?fc=R

visitors can't be wrong...

page last uploaded: 2 September 2010, 18:50