If your script needs to determine if it is running on a workstation or a server, you can use the following code
snippet:
if not "%OS%"=="Windows_NT" goto notNT set rf="%TEMP%\ProductName_%RANDOM%.reg" regedit /a %rf% "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" set srv=NO for /f "Tokens=*" %%s in ('type %rf%^|Findstr /I /C:"ProductName"^|Findstr /I /C:"Server"') do ( set srv=YES ) del /q %rf% if "%srv%" EQU "YES" goto IsServer :: Workstation here
0 comments
Hide comments