Subscribe to Windows IT Pro
March 25, 2002 12:00 AM

Alternative to BAT vs. CMD

Windows IT Pro
InstantDoc ID #24048
Rating: (0)

In Reader to Reader: "BAT vs. CMD" (July 2001, InstantDoc ID 21110), Chris Taylor recommends naming batch files with a .bat or .cmd extension depending on whether the files will run in Windows 9x (.bat) or Windows 2000 or Windows NT (.cmd). You can also use the .cmd extension for Windows XP. I prefer to use the following code in my batch files to determine the underlying OS and branch to the appropriate sections of code:

If "%OS%" 

"Windows_NT" goto winnt If NOT "%WINBOOTDIR%"

"" goto win95

If you use this method, remember to make :winnt and :win95 portions in your script. Also, you need to create an :end portion and use the Goto command to send both sections there. Otherwise, you might run both sections on one of the two platforms.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.