开发者

Using Powershell to automating a bat file that ends with PAUSE

I have a batch file that I can't change, but I want to automate with Powershell 2.0. It ends with a PAUSE command, which displays:

Press any key to continue...

Is there an way to ca开发者_JAVA百科ll this batch file from a powershell script, but have it exit without needing a user to press something?


You can pipe anything into the cmd process:

'' | cmd /c foo.cmd

which will be treated as input by cmd and that's enough for pause to stop pausing.

Sample code here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜