bat 命令执行结果赋给变量

@echo off & color 0d & setlocal enabledelayedexpansion
ipconfig>ip.txt
for /f "delims=" %%a in (ip.txt) do (
set ip=%%a
echo !ip!
)
pause>nul


@echo off
set strA=
set strB=
set strC=
set strD=
findstr "AAAAA" *.txt >nul 2>&1 && set strA=A
findstr "BBBBB" *.txt >nul 2>&1 && set strB=B
findstr "CCCCC" *.txt >nul 2>&1 && set strC=C
findstr "DDDDD" *.txt >nul 2>&1 && set strD=D
echo 存在:%strA%%strB%%strC%%strD%

你可能感兴趣的:(bat 命令执行结果赋给变量)