logon script for OS

T

Tsuru

Someone answered my post about checking for the Operating
System and gave me the following script. But I wanted a
little more help please. I want to run something after I
determine the OS:

@echo off
set OpSys=Unknown OS
ver | find /i "Windows 95" > nul
if not ErrorLevel 1 set OpSys=Win95
ver | find /i "Windows 98" > nul
if not ErrorLevel 1 set OpSys=Win98
ver | find /i "Windows NT" > nul
if not ErrorLevel 1 set OpSys=WinNT
ver | find /i "Windows 2000" > nul
if not ErrorLevel 1 set OpSys=Win2K
ver | find /i "Windows XP" > nul
if not ErrorLevel 1 set OpSys=WinXP
echo This machine runs %OpSys%


After I determine if a machine is running Win2K, Win NT,
or WinXP then I want to run a command like:

start \\abcdefg\xyz\ddd.exe

------ dependent upon the OS only being Win2K, WinXP, or
Win NT


Could you help me with this please? I've tried just
adding an IF, then, Else but it doesn't do anything!

Thx in advance for your time,

Tsuru
 
P

Pegasus

Tsuru said:
Someone answered my post about checking for the Operating
System and gave me the following script. But I wanted a
little more help please. I want to run something after I
determine the OS:

@echo off
set OpSys=Unknown OS
ver | find /i "Windows 95" > nul
if not ErrorLevel 1 set OpSys=Win95
ver | find /i "Windows 98" > nul
if not ErrorLevel 1 set OpSys=Win98
ver | find /i "Windows NT" > nul
if not ErrorLevel 1 set OpSys=WinNT
ver | find /i "Windows 2000" > nul
if not ErrorLevel 1 set OpSys=Win2K
ver | find /i "Windows XP" > nul
if not ErrorLevel 1 set OpSys=WinXP
echo This machine runs %OpSys%


After I determine if a machine is running Win2K, Win NT,
or WinXP then I want to run a command like:

start \\abcdefg\xyz\ddd.exe

------ dependent upon the OS only being Win2K, WinXP, or
Win NT


Could you help me with this please? I've tried just
adding an IF, then, Else but it doesn't do anything!

Thx in advance for your time,

Tsuru

Simple:

@echo off
ver | find /i "Windows NT" > nul
if not ErrorLevel 1 goto Action
ver | find /i "Windows 2000" > nul
if not ErrorLevel 1 goto Action
ver | find /i "Windows XP" > nul
if not ErrorLevel 1 goto Action
goto Exit

:Action
start \\abcdefg\xyz\ddd.exe

:Exit

You could also to this:

@echo off
if not "%SystemRoot%"=="" start \\abcdefg\xyz\ddd.exe
 
T

Tsuru

Thanks so much!!!!

Tsuru


-----Original Message-----



Simple:

@echo off
ver | find /i "Windows NT" > nul
if not ErrorLevel 1 goto Action
ver | find /i "Windows 2000" > nul
if not ErrorLevel 1 goto Action
ver | find /i "Windows XP" > nul
if not ErrorLevel 1 goto Action
goto Exit

:Action
start \\abcdefg\xyz\ddd.exe

:Exit

You could also to this:

@echo off
if not "%SystemRoot%"=="" start \\abcdefg\xyz\ddd.exe


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top