开发者

How to express the following batch steps in a single cmd invocation?

Assume I have steps in a batch file as follows.

set 开发者_StackOverflowdir=%CD%
cd ..\notes
dir /b *.tex > %dir%\log.txt
cd %dir%

How to express these steps in a single cmd call?

I attempted to call as follows

cmd /c set dir=%CD% cd ..\notes dir /b *.tex > %dir%\log.txt cd %dir%

but it did not work.


This should work

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜