运行程序并等待进程完成

时间:2016-01-17 07:47:31

标签: batch-file scripting

我有一个简单的BAT sdcript应该运行WTVCnverter。我希望它通过* .wtv匹配所有文件并使用程序转换为dvr-ms。在执行第二个或第三个文件之前,它应该等待WTVConverter退出然后继续。

 @echo off


 for %%f in (*.in) do (

      echo %%~nf
      C:\Windows\ehome\WTVConverter.exe "%%~nf.wtv""%%~nf.dvr-ms" /ShowUI | out-null

 )

1 个答案:

答案 0 :(得分:1)

在批处理文件中(尽管您的代码按键入的方式工作)在命令前添加cmd /c start "" /w所以

cmd /c start "" /w C:\Windows\ehome\WTVConverter.exe "%%~nf.wtv""%%~nf.dvr-ms" /ShowUI | out-null

GUI流程(即非控制台)在批处理中等待,但在键入时则不等待。请参阅start /?

管道也由cmd.exe实现。如果您的竖线字符用于程序转义^

你似乎缺少in和out文件名之间的空格。

相关问题