Page 1 of 1

ver in batch file

Posted: 17 Mar 2009 13:17
by Chonn
I'm so glad I found this site! Thanks ahead of time for your help.

I'm looking to get the ver command to work in a batch file.

I have tried %ver% and a few others but it's not working like %date% does.

Any help is greatly appreciated!

Chonn

Posted: 17 Mar 2009 15:07
by RElliott63
What are you trying to do with it?

Posted: 17 Mar 2009 15:30
by Chonn
I'm trying to run some commands that are OS specific (netsh firewall commands for 2003 and 2008) and I need to do some logic ahead of time to determine what my OS is. I will be using this file on other OSes (win7) at a later date so I need to set up the logic correctly now.

Thanks!

Chonn

Posted: 17 Mar 2009 16:21
by Chonn
I found what I was looking for through a co-worker. Just for future reference and to help others here was my solution.

%echo_cmd% ver | findstr -c:" 5.1." > NUL: && set OSVER=WINXP
%echo_cmd% ver | findstr -c:" 5.2." > NUL: && set OSVER=WIN2K3
%echo_cmd% ver | findstr -c:" 6.0." > NUL: && set OSVER=WIN2K8

Good luck!

Chonn