GetType Topics | Previous

GetType Examples


Using GetType within a batch file, you can create scripts that run only if a specific platform is detected. See the sample batch file below. Platforms GetType recognizes include:

To use GetType within a script

  1. Create a batch file similar to the following:
    @echo off
    REM Batch file to detect operating system
    REM ----------------------------------
    if Windows_NT == %OS% goto WINNT
    echo You are NOT running Windows NT (Windows 95/98 perhaps?)
    goto END
    
    :WINNT
    gettype.exe
    
    if errorlevel=9 goto FILENOTFOUND
    
    echo You are running Windows NT.
    echo More Specifically:
    echo.
    
    
    if ERRORLEVEL=8 goto EIGHT
    if ERRORLEVEL=7 goto SEVEN
    if ERRORLEVEL=6 goto SIX
    if ERRORLEVEL=5 goto FIVE
    if ERRORLEVEL=4 goto FOUR
    if ERRORLEVEL=3 goto THREE
    if ERRORLEVEL=2 goto TWO
    if ERRORLEVEL=1 goto ONE
    
    :FILENOTFOUND
    echo.
    echo Gettype not found.
    echo.
    goto END
    
    :EIGHT
    echo Windows NT [Enterprise/Terminal] Server Non-Domain Controller
    goto END
    
    :SEVEN
    echo Windows NT [Enterprise/Terminal] Server Domain Controller
    goto END
    
    :SIX
    echo Windows 2000 Server Domain Controller.
    goto END
    
    :FIVE
    echo Windows NT Server Domain Controller.
    goto END
    
    :FOUR
    echo Windows 2000 Server Non-Domain Controller.
    goto END
    
    :THREE
    echo Windows NT Server Non-Domain Controller.
    goto END
    
    :TWO
    echo Windows 2000 Professional installation.
    goto END
    
    :ONE
    echo Windows NT Workstation.
    goto END
    
    :END
    pause
  2. Copy Gettype.exe and the batch file to the target workstations and run.