General Question

XOIIO's avatar

Is there a file that is specific to each operating system?

Asked by XOIIO (18288points) 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)
if exist C:\Windows\filename2 (GOTO win7) else (goto 95)

Something along the lines of this.

Observing members: 0 Composing members: 0

7 Answers

Not_the_CIA's avatar

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
john-powells-iMac:~ johnpowell$

Windows should have something similar.

XOIIO's avatar

YEah, I’ve been looking around. I might jst have to make a menu to choose the os.

jaytkay's avatar

I haven’t tried this, but FWIW
“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.”

XOIIO's avatar

@jaytkay Not bad, I’m having a bit of trouble adapting it to my use though…

XOIIO's avatar

bah, batch menu it is.

XOIIO's avatar

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




to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther