Thursday, June 24, 2010

Quick batch file to check OS version…

How to check the Operation System version
if OS is 32 bit or 64 bit

Quick batch file to check OS version…




@echo off

Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0

REG.exe Query %RegQry% > checkOS.txt

Find /i "x86" < CheckOS.txt > StringCheck.txt

If %ERRORLEVEL% == 0 (

Echo "This is 32 Bit Operating system"

) ELSE (

Echo "This is 64 Bit Operating System"

)

pause

1 comment:

  1. a little more you might like:


    @echo off

    Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0

    REG.exe Query %RegQry% > checkOS.txt

    Find /i "x86" < CheckOS.txt > StringCheck.txt

    If %ERRORLEVEL% == 0 (

    Echo "This is 32 Bit Operating system"

    ) ELSE (

    Echo "This is 64 Bit Operating System"

    )

    pause

    del StringCheck.txt
    del checkOS.txt

    systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

    Set K_="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    Set "P_=Service Pack 3"
    Reg query %K_% /v CSDversion|Find "%P_%">Nul 2>&1&&(
    Echo:%P_% Already Installed. Please reboot now && ping -n 60 127.0.0.1>nul)||(
    Echo:Installing %P_%&WindowsXP-KB936929-SP3-x86-ENU.exe /quiet)

    ReplyDelete