批处理判断语句
方法一:判断%processor_architecture%
if /i "%processor_architecture%"=="x86" (echo 32位) else (echo 64位)
echo %processor_architecture% | find "86" >nul && if %errorlevel% equ 0 echo 32 Bit
echo %processor_architecture% | find "64" >nul && if %errorlevel% equ 0 echo 64 Bit
方法二:文件夹判断系统位数
if not exist %systemroot%\SysWOW64 goto 32bit
goto 64bit
------------------------------------------------------------------------------------------------------------------
Powershell判断语句
$Is64BitOS = [Environment]::Is64BitOperatingSystem
If ($Is64BitOS -eq $true)
{
$propath = "C:\Program Files (x86)"
}
else
{
$propath = "C:\Program Files"
}
if ([Environment]::Is64BitOperatingSystem) { $propath = "C:\Program Files (x86)" }
else { $propath = "C:\Program Files" }