Running Win2K Batch Files on NT 4.0

Copy and rename the command processor for each OS to test batch files on Win2K and NT 4.0 console shells.

Alex Angelopoulos

July 21, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Editor's Note: Share your Windows and .NET discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows & .NET Magazine readers (including Microsoft). Email your contributions (400 words or less) to [email protected]. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Submissions and listings are available online at http://www.winnetmag.com/articles. Enter the InstantDoc ID number in the InstantDoc ID text box.

When I started using Windows 2000, I found some of the OS's updated command-processor's special features useful for writing batch files. In particular, I often used delayed expansion and the built-in %date% and %time% variables. Although I still supported more Windows NT 4.0 systems than Win2K systems, I soon discovered that I occasionally wrote batch files that wouldn't run on both OSs. I developed an easy method for testing batch files on Win2K and NT 4.0 console shells—I simply copy and rename the command processor for each OS. My test system's Tools folder contains the files w2kcmd.exe (version 5.0.2144.1 from the Win2K release version), w2kcmdp1.exe (version 5.0.2195.1600 from Win2K Service Pack 1—SP1), and nt4cmd.exe (version 4.0.1381.273 from NT 4.0 SP6a). I can quickly start a console session in the appropriate command-line shell version to check batch files for correct functionality.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like