简体   繁体   English

如何在后台从命令行启动 GUI 应用程序?

[英]How to start a GUI app from the command line in the background?

I'm using start cmd.exe /c to start new command line processes in the background.我正在使用start cmd.exe /c在后台启动新的命令行进程。 But when I execute GUI apps this way, it creates an unnecessary command line window.但是当我以这种方式执行 GUI 应用程序时,它会创建一个不必要的命令行 window。

If the program you want to start needs to be quoted since it contains spaces or shell metacharacters in its path, then you need to supply an empty quoted argument to start :如果您要启动的程序需要被引用,因为它的路径中包含空格或 shell 元字符,那么您需要为start提供一个空的引用参数:

start "" "C:\Program Files\SomeProgram\Some program.exe"

That's because start interprets the first quoted argument as the title for a new console window, running cmd .这是因为start将第一个引用的参数解释为运行cmd的新控制台 window 的标题。

Just say start myprogram.exe .只需说start myprogram.exe It'll return immediately and it won't start an unnecessary instance of the shell.它会立即返回,并且不会启动 shell 的不必要实例。

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

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