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.
精彩评论