bat 執行結果賦值命令
for /f "delims=" %%i in ('dir ') do set b=%%i
- 直接講dir 命令修改為任何需要執行的命令
`@echo off
echo %path%>tmp
set b=
::set TMP_STR=('findstr "CAT" tmp')
for /f "delims=" %%i in ('findstr "CAT" tmp') do (
set b=%%i
)
if "%b%" == "" (
echo "aaaaaaaaaaaaaa"
) else (
echo "abb"
)`