Naveen
Naveen

Reputation: 121

Detect windows os version in shell script

Hi Is there a way to determine windows os version in shell script ?

My requirement is

if OS_Version >= win_vista run cmd1 else run cmd2

Upvotes: 1

Views: 944

Answers (1)

Java42
Java42

Reputation: 7706

The command to get the version is ver. Parse the version.txt file then do your compare.

C:\>ver >version.txt
C:\>type version.txt
Microsoft Windows [Version 6.1.7601]

Upvotes: 2

Related Questions