Batch files - Examples (L*)

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 LastFile.bat Reopen most recently used file from the Documents folder NT 20/10/2001  
Download the ZIPped sources LeapYear.bat (DOS) Check if the current year is a leap year or not DOS 16/12/2002 DOS version uses BatchMan by Michael Mefford.
NT version uses code to extract current year by Simon Sheppard.
Also available as JScript, Kix, Perl, PowerShell, Rexx and VBScript scripts.
LeapYear.bat (NT) Check if the specified year is a leap year or not NT 05/10/2002
Download the ZIPped sources ListICA.bat List all IP addresses associated with Citrix' ICA round robin alias in DNS NT 25/10/2004  
Download the ZIPped sources LstOffVw.bat List all Office Viewers and their version numbers W2K 17/05/2008 Also available in VBScript.
This batch file uses FILEVER.EXE and is about 10 times as fast as the WMI/VBScript version.
Download the ZIPped sources ListPRN.cmd List specified (NT) or all (NT and OS/2) network printers' UNC path NT OS2 05/06/2000  
Download the ZIPped sources ListSDKs.bat List installed Microsoft SDKs, or display the version number for a specified SDK XP 30/05/2008  
Download the ZIPped sources LoCase.bat
UpCase.bat
Convert filenames to all uppercase or all lowercase NT OS2 20/11/2001 New LoCase.bat uses a trick by Niels Stout; it is much faster, but can be used in the current directory only; the old version is still available in case you need to rename files in other directories.
Available for OS/2 (Rexx) as well: LoCase.cmd and UpCase.cmd
Now also available in KiXtart: LoCase.kix and UpCase.kix
Download the ZIPped sources LockProg How to lock single user programs when in use on a network All 13/07/1999  
Download the ZIPped sources LogBatch.bat Log every individual command line of a batch file W2K 07/11/2007  
Download the ZIPped sources LogHist.bat Read URLs from IE history and write them to a file named %UserName%.hst NT 20/10/2003  
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