测试系统变量: | @echo off&setlocal enabledelayedexpansion | | for /l %%a in (1,1,100) do set "d=!d!&echo d" | | call :lp os | | call :lp os a setlocal endlocal | | call :lp os | | del /q db&pause | | goto :eof | | :lp | | %3 | | if "%2" neq "" set "%1=%2" | | (echo d2cl2 | | echo q | | echo, | | )>db | | (for /f "skip=1 tokens=2,3" %%a in ('debug^<db') do ( | | echo d%%b%%a:0000%d%&echo q&echo, | | ))>tem | | del /q db&ren tem db | | for /f "delims=" %%a in ('debug^<db^|findstr /i "%1="') do echo %%a | | echo, | | %4COPY |
| 0DBD:03F0 52 4F 43 45 53 53 4F 52-53 3D 32 00 4F 53 3D 57 ROCESSORS=2.OS=W | | | | 0DBD:03F0 52 4F 43 45 53 53 4F 52-53 3D 32 00 4F 53 3D 61 ROCESSORS=2.OS=a | | | | 0DBD:03F0 52 4F 43 45 53 53 4F 52-53 3D 32 00 4F 53 3D 57 ROCESSORS=2.OS=W | | | | Press any key to continue . . .COPY |
系统变量os在setlcoal-enlocal中去哪里了?,假如将os改成path,运行结果如下: | 0DBD:0400 69 6E 64 6F 77 73 5F 4E-54 00 50 41 54 48 3D 43 indows_NT.PATH=C | | | | 'debug' is not recognized as an internal or external command, | | operable program or batch file. | | 'debug' is not recognized as an internal or external command, | | operable program or batch file. | | | | 0DBD:0400 69 6E 64 6F 77 73 5F 4E-54 00 50 41 54 48 3D 43 indows_NT.PATH=C | | | | Press any key to continue . . .COPY |
在重新设定path后,debug命令变得无效。 |