Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for is6432os.bat

(view source code of is6432os.bat as plain text)

  1. @ECHO OFF
  2. SETLOCAL
  3. IF "%~1"=="" (SET Computer=%ComputerName%) ELSE (SET Computer=%~1)
  4. IF /I NOT "%Computer%"=="%ComputerName%" (
  5. 	PING %Computer% -n 2 2>NUL | FIND "TTL=" >NUL || GOTO Syntax
  6. )
  7. FOR /F "tokens=2 delims==" %%A IN ('WMIC /Node:%Computer% Path Win32_Processor Get AddressWidth /Format:list') DO SET OSB=%%A
  8. ECHO %OSB%-bit
  9. EXIT /B %OSB%
  10.  
  11.  
  12. :Syntax
  13. ECHO.
  14. ECHO is6432os.bat,  Version 1.00 for Windows XP Professional and later
  15. ECHO Detect if the OS is 32-bit or 64-bit
  16. ECHO.
  17. ECHO Usage:   IS6432OS.BAT
  18. ECHO.
  19. ECHO Return:  return code 32 for 32-bit OS, 64 for 64-bit, or 1 for error
  20. ECHO.
  21. ECHO Written by Rob van der Woude
  22. ECHO http://www.robvanderwoude.com
  23. EXIT /B 1
  24.  

page last uploaded: 2017-04-06, 13:33