简体   繁体   English

通过White从批处理文件启动应用程序

[英]Launching an application from a batch file through White

I am trying to have White detect an application that starts from a batch file. 我试图让怀特检测从批处理文件开始的应用程序。 The current code I have is: 我当前的代码是:

Application application = Application.Launch(@"C:\WINNT\system32\calc.exe");

This works fine for openning applications from its .exe, but when I tried: 对于从其.exe打开应用程序,此方法工作正常,但是当我尝试执行以下操作时:

Application application = Application.Launch(@"C:\WINNT\system32\test.bat");

It did not launch the .bat. 它没有启动.bat。 I am assuming even if the ,bat ran,the application would be assign to cmd.exe instead of my actual application from the batch. 我假设即使.bat运行,该应用程序也将分配给cmd.exe,而不是批处理中的实际应用程序。 Is there any way for me to set the application such that it search for the application from the process tree? 我有什么办法设置应用程序,以便它从进程树中搜索应用程序?

Thanks 谢谢

Try launching with this command line instead: 尝试使用以下命令行启动:

@"C:\WINNT\system32\cmd.exe /c C:\WINNT\system32\test.bat"

Cmd.exe is the EXE that interprets .bat or .cmd script files. Cmd.exe是解释.bat或.cmd脚本文件的EXE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM