脚本批处理,运行 外部 exe 并获取他的 PID
Script Batch, run external exe and get his PID
我有一个批处理脚本 A。这个脚本 运行 一个 .exe 应用程序,一段时间后,脚本 A 停止了 .exe 应用程序。
我的问题是我 运行 我的脚本 A 在几个 shell 中。因此,我同时多次执行同一个 .exe 应用程序(但 PID 不同)
我的问题是,如何批量 运行 外部 .exe 并获取他的 PID?
如果我 运行 exe 和我捕获他的 PID,我可以停止 "good" .exe。
For /f "tokens=2 delims=;= " %A in ('wmic process call create notepad.exe ^| findstr /c:ProcessId') Do Echo %A
For 是从命令中获取输出的命令。 WMIC returns 它启动的程序的 PID。
wmic process call create notepad.exe
在批处理文件中,键入时使用 %%A
而不是 %A
。
我有一个批处理脚本 A。这个脚本 运行 一个 .exe 应用程序,一段时间后,脚本 A 停止了 .exe 应用程序。 我的问题是我 运行 我的脚本 A 在几个 shell 中。因此,我同时多次执行同一个 .exe 应用程序(但 PID 不同)
我的问题是,如何批量 运行 外部 .exe 并获取他的 PID? 如果我 运行 exe 和我捕获他的 PID,我可以停止 "good" .exe。
For /f "tokens=2 delims=;= " %A in ('wmic process call create notepad.exe ^| findstr /c:ProcessId') Do Echo %A
For 是从命令中获取输出的命令。 WMIC returns 它启动的程序的 PID。
wmic process call create notepad.exe
在批处理文件中,键入时使用 %%A
而不是 %A
。