ver in batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Chonn
Posts: 9
Joined: 17 Mar 2009 13:12

ver in batch file

#1 Post by Chonn » 17 Mar 2009 13:17

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

RElliott63
Expert
Posts: 80
Joined: 04 Feb 2009 10:03

#2 Post by RElliott63 » 17 Mar 2009 15:07

What are you trying to do with it?

Chonn
Posts: 9
Joined: 17 Mar 2009 13:12

#3 Post by Chonn » 17 Mar 2009 15:30

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

Chonn
Posts: 9
Joined: 17 Mar 2009 13:12

#4 Post by Chonn » 17 Mar 2009 16:21

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

Post Reply