2011-08-09 22 views
1

假設我在批處理文件中有如下步驟。如何在單個cmd調用中表示以下批處理步驟?

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% 

,但沒有奏效。

回答

2

這應該工作

cmd /c "pushd ..\notes & dir /b *.tex > %cd%\log.txt & popd" 
+0

從未使用pushd和popd的(讀到過一次)。做得很好 :) – Tim

相關問題