是否可以先等待第一个批处理文件处理,然后再处理另一个批处理文件?如果我同时运行多个批处理文件,则会收到错误消息“该应用程序的另一个实例已在运行。请在使用任何其他程序之前关闭应用程序对话框。”同时多次调用program.exe时。
这是我尝试过的
@echo off
START /Wait cmd.exe /K "C:\Users\Folder\Pictures\batchFile\Encrypt\encrypt.bat"
这是用于加密pdf文件的加密文件命令:
"C:\Program Files (x86)\Folder\Program.exe" PROTECT "C:\Users\Folder\Pictures\test1.pdf" /OUTPUT "C:\Users\Folder\Pictures\d"
有什么想法要实现吗?
答案 0 :(得分:-1)
您可以使用以下代码一个一个地执行批处理文件。
System.Diagnostics.Process SysDiag = null;
SysDiag = Process.Start(new System.Diagnostics.ProcessStartInfo(yourBatchFilePath));
while (SysDiag.HasExited == false)
{}