File 为什么我的.bat总是在执行冗长的命令后丢失其变量
这是我遭受逆境的蝙蝠。让我们把它命名为File 为什么我的.bat总是在执行冗长的命令后丢失其变量,file,variables,batch-file,File,Variables,Batch File,这是我遭受逆境的蝙蝠。让我们把它命名为b.bat set loopnum=%1 set url=%2 del "%TEMP%\selectortemp.txt" del "%TEMP%\selectortemp2.txt" for /r %loopnum% %%i in (\*.*) do echo %%~ni%%~xi>>"%TEMP%\selectortemp.txt" echo %loopnum% pause set count=0 for /f "usebackq del
b.bat
set loopnum=%1
set url=%2
del "%TEMP%\selectortemp.txt"
del "%TEMP%\selectortemp2.txt"
for /r %loopnum% %%i in (\*.*) do echo %%~ni%%~xi>>"%TEMP%\selectortemp.txt"
echo %loopnum%
pause
set count=0
for /f "usebackq delims=" %%a in (%TEMP%\selectortemp.txt) do set /a count+=1
set /a count2=1
:looping
for /f "tokens=1,2 delims==" %%a in (%config%) do (if %%a==url set url=%%b)
set /p firstline=<"%TEMP%\selectortemp.txt"
del "%url%\%firstline%"
echo "%firstline%"
pause
for /f "skip=1 tokens=*" %%A in (%TEMP%\selectortemp.txt) do echo %%A>>"%TEMP%\selectortemp2.txt"
del "%TEMP%\selectortemp.txt"
rename "%TEMP%\selectortemp2.txt" "selectortemp.txt"
if %count2%==%count% goto endlooping
set /a count2+=1
goto looping
:endlooping
你的问题不是很具体。 我想你的意思是你的变量在for循环中丢失了它们的内容 你需要写作!a!而不是%a%。但是您不能使用for循环中使用的变量来执行此操作!!这是不可能的 确保启用延迟扩展
这里有一些关于enabledelayedexpansion的信息:你说的“丢失变量”是什么意思?请再描述一下你的问题。(使用编辑按钮向您的帖子添加更多信息。下次,请使用代码/批处理文件的
{}
code按钮。)sry。。。我发现了。事实上蝙蝠不会把它弄丢的。我的意思是它不会变成emty变量。然而,这是因为我的循环太差,以至于.bat崩溃。下次我将使用{}。谢谢您。
for /l %%i in (0,1,3) do (call b.bat %%i C:\testing)