C
Craig
Hi folks,
I have a simple batch file that I've written that doesn't
properly detect which OS I'm running, and I'm not sure
why. Here it is:
@echo off
echo.
for /F "tokens=2* delims= " %%A IN ('REG
QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion" /v ProductName') do set os=%%B
echo %os%
pause
If "%OS%" == Microsoft Windows XP
goto xp
If "%OS%" == Microsoft Windows 2000
goto w2k
goto exit
:w2k
echo You're running Windows 2000
pause
exit
:xp
echo You're running Windows XP
pause
:exit
exit
What am I doing wrong??? Also, if this batch file is run
on another OS (Win98, etc.), it should just exit, right???
Thank you,
Craig
I have a simple batch file that I've written that doesn't
properly detect which OS I'm running, and I'm not sure
why. Here it is:
@echo off
echo.
for /F "tokens=2* delims= " %%A IN ('REG
QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion" /v ProductName') do set os=%%B
echo %os%
pause
If "%OS%" == Microsoft Windows XP
goto xp
If "%OS%" == Microsoft Windows 2000
goto w2k
goto exit
:w2k
echo You're running Windows 2000
pause
exit
:xp
echo You're running Windows XP
pause
:exit
exit
What am I doing wrong??? Also, if this batch file is run
on another OS (Win98, etc.), it should just exit, right???
Thank you,
Craig