将多行窗口批处理脚本压缩为一行



我正在尝试将以下内容压缩为可以在命令提示符中使用的一行。我尝试过在 && 和 & |和 ||没有成功,我不断得到

。这时出乎意料。

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

@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
)
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")

最新更新