Discussion Locked

Detecting type of OS with batch script

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

We have a mixture of 95, 98 and 2000 machines. The particular file I want to copy has a different folder location depending on what OS is running. Is there a method of detecting the relevent OS on login.

Thanks

Justin

Justin

6 replies

by jb007

www.jsiinc.com makes a tool called windows information 2.3 that can determine version of OS (win2k,nt4) from a registry setting.

ProductType, a string value, at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions

I'm not sure ifthere is a win9x equivalent.

regards,

James.

by jb007

ooops i forgot something even simpler.

VER command at each machine will return version.

James.

by chrischapman.za

Write a batch file with the following code:
@echo off
cls
c:
if "%OS%" == "Windows_NT" goto NT4

:W95
cd \*path goes here*
goto END

:NT4
cd \*path goes here*

:END

underneath the ":END" you can put in your commands to copy the file.
We use this for Win 9x, NT and 2000 to copy hosts files, I'm not sure if this is what you need or not but perhaps it might help you.

This discussion is closed to new replies.