Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 转到后popd上出错_Batch File_Cmd - Fatal编程技术网

Batch file 转到后popd上出错

Batch file 转到后popd上出错,batch-file,cmd,Batch File,Cmd,我有以下代码: @echo off setlocal EnableDelayedExpansion FOR /F "tokens=1,2 delims= " %%i in ( C:\folder\varibales_file.txt ) do ( set numOfFiles=%%j pushd %%i call :Sub !numOfFiles! popd ) popd goto :EOF :Sub numOfFiles for /f "skip=%1 delim

我有以下代码:

@echo off
setlocal EnableDelayedExpansion

FOR /F "tokens=1,2 delims= " %%i in ( C:\folder\varibales_file.txt ) do (
   set numOfFiles=%%j
   pushd %%i
   call :Sub !numOfFiles!
   popd
)

popd
goto :EOF

:Sub numOfFiles
for /f "skip=%1 delims=" %%F in ('dir "C:\folder_path_to_delete\%%i" /b /o-d') do (
   rd /s /q "C:\folder_path_to_delete\%%i\%%F"
)
我遇到以下错误:“系统找不到指定的路径。” 此错误是由于插入“转到之前的popd”而发生的
有人知道如何解决吗?

此错误是由于插入“popd before goto”而导致的,您怎么知道?
popd
命令和
goto
命令都与路径无关。如果你没有足够的信息,你永远不应该下结论。。。不应该
C:\folder\variables\u file.txt
名称是
C:\folder\variables\u file.txt
?不,这不是我的真实路径,我在这里编写代码时更改了文件夹名称。无论如何,当我删除“popd”时,错误不会发生。您知道
for
循环是否正常运行吗?如果有什么东西让它跳过循环,它会找到一个没有先前的
pushd
popd
,并对你大喊大叫。