Sign in with
Sign up | Sign in
Your question

How to make same bat file which would work for both Windows 7 and Windows XP

Last response: in Windows 7
November 20, 2012 3:53:54 AM


I want to know how can we create the same bat file that would work for both XP and windows7. Is it possible to make same bat file for both O.S.??
a c 228 $ Windows 7
November 20, 2012 1:04:07 PM

You need conditional statements in your bat file. You can check the OS environment variable and act on that.
a b $ Windows 7
November 20, 2012 1:23:19 PM

^+1 some of the commands are a little different so you have to figure out what OS, and then point the script to run those commands. I've seen scripts that do this, and I'm sure you can find some examples out there somewhere if you search for them.
Related resources