1.

Solve : Batch to Run only on XP machines?

Answer»

I'm looking for batch file command have it run only on XP machines. I'm a bit new to Win management and have looked all over but have not found a line that WORKS. Much thanks!What other operating systems might it run on? Are Windows 95/98/ME a possibility? is NT 3.51 or 4? or are we talking about just 2000 / XP / Vista?

It is a trivial matter to capture the output of the VER command, and see if it contains the string "MICROSOFT Windows XP" or not, but some ways of doing this won't work on 95/98/ME.
Quote from: Dias de verano on January 29, 2009, 01:35:28 PM

What other operating systems might it run on? Are Windows 95/98/ME a possibility? is NT 3.51 or 4? or are we talking about just 2000 / XP / Vista?


Just XP and Vista only. I've gotten this far:

Quote
Ver | Find "XP" > Nul
If not ErrorLevel 1 COPY \\SERVER\SHARE\FWOFF.VBS C:\
Ver | Find "VISTA" > Nul
If not ErrorLevel 1 COPY \\SERVER\SHARE\FWOFF.VBS c:\
CALL "c:\fwoff.vbs"
DEL c:\fwoff.vbs

Which works on XP but not Vista. So I think I'm close enough to get it now.@echo off
ver | find "Microsoft Windows XP">nul || (
echo This script should only be run on Windows XP
pause
goto END
)

Your code here

:end
Thanks!!


Discussion

No Comment Found