Is there a file that is specific to each operating system?
Asked by
XOIIO (
18288
)
December 29th, 2010
I am working of a batch program, and it is an installation program. I would like it to be able to detect the operating system automatically using the IF EXIST command. Is there a specific file for xp, vista\7 and other operating systems that I could use?
For exaple if exist C:\Windows\filename (GOTO xp) else—(goto—next)
:next
if exist C:\Windows\filename2 (GOTO win7) else (goto 95)
Something along the lines of this.
Observing members:
0
Composing members:
0
7 Answers
It should be reported somewhere. At least it is on OS X. So google might help you put it into a variable.
john-powells-iMac:~ johnpowell$ sw_vers -productVersion
10.6.5
john-powells-iMac:~ johnpowell$
Windows should have something similar.
YEah, I’ve been looking around. I might jst have to make a menu to choose the os.
I haven’t tried this, but FWIW
http://malektips.com/xp_dos_0025.html
“The following batch file will determine whether or not the machine is running Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, Windows 2000, or Windows NT. It can easily be modified to support other versions of Windows as necessary or to set an environment variable based on the version of Windows detected.”
@jaytkay Not bad, I’m having a bit of trouble adapting it to my use though…
Well I finished my program. It’s a program to clean up files on your desktop. If anyone would like to try it out you can get it here
Feedback would be appreciated if you try it out.
Answer this question 
This question is in the General Section. Responses must be helpful and on-topic.