Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.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 如何在单个cmd调用中表示以下批处理步骤?_Batch File_Dos - Fatal编程技术网

Batch file 如何在单个cmd调用中表示以下批处理步骤?

Batch file 如何在单个cmd调用中表示以下批处理步骤?,batch-file,dos,Batch File,Dos,假设我在批处理文件中有如下步骤 set dir=%CD% cd ..\notes dir /b *.tex > %dir%\log.txt cd %dir% 如何在单个cmd调用中表达这些步骤 我试图打电话如下 cmd /c set dir=%CD% cd ..\notes dir /b *.tex > %dir%\log.txt cd %dir% 但它不起作用。这应该起作用 cmd /c "pushd ..\notes & dir /b *.tex > %cd%\

假设我在批处理文件中有如下步骤

set dir=%CD%
cd ..\notes
dir /b *.tex > %dir%\log.txt
cd %dir%
如何在单个
cmd
调用中表达这些步骤

我试图打电话如下

cmd /c set dir=%CD% cd ..\notes dir /b *.tex > %dir%\log.txt cd %dir%
但它不起作用。

这应该起作用

cmd /c "pushd ..\notes & dir /b *.tex > %cd%\log.txt & popd"
从未使用过pushd和popd(阅读一次)。做得好:)