0

我正在尝试将以下内容浓缩为一个可在命令提示符下使用的衬里。我试过在 && 和 & 和 | 之间交替 和 || 没有成功,我不断得到

……在这个时候是出乎意料的。

是否可以将其压缩为一行?

@echo off
setlocal enableextensions enabledelayedexpansion

for /f "delims=" %%l in ('wmic computersystem get SystemType^ /format:list') do >nul 2>&1     set "System_%%l" 

if "%System_SystemType%" == "x64-based PC" (
echo 64bit
) else (
echo 32bit
)
4

1 回答 1

3
wmic computersystem get SystemType | find "x64" >nul&& echo 64bit || echo 32bit

并带有一个额外的环境变量SystemType

wmic computersystem get SystemType | find "x64" >nul&& (echo 64bit&set "SystemType=64bit") || (echo 32bit&set "SystemType=32bit")
于 2013-09-20T19:39:16.347 回答