[英]How do I run a program minimized from Perl on Windows?
I have a Perl script which starts as an ".exe" (along with my main application) 我有一个以“ .exe”开头的Perl脚本(以及我的主应用程序)
The job of this perlapp is that it queries how long the application has been open (we have floating license and to free up license we close the main application automatically after 120 mins) 该perlapp的工作是查询应用程序打开了多长时间(我们拥有浮动许可证,要释放许可证,我们会在120分钟后自动关闭主应用程序)
During this process the perlapp which runs in the background invokes another application and it's called system
在此过程中,在后台运行的perlapp调用另一个应用程序,该system
称为system
All works as fine except that the called application via system
pops up in the foreground. 除通过system
调用的应用程序在前台弹出以外,其他所有功能均正常运行。 I want to run it as "minimized". 我想将其运行为“最小化”。 Is this possible? 这可能吗?
What you need is not Perl-specific, but actually part of your Windows operating system. 您所需的不是Perl特定的,而是Windows操作系统的一部分。 In order to start any program minimized on Windows, use the following command. 为了启动Windows上最小化的任何程序,请使用以下命令。
> start /MIN foo.exe
Now to use this from your Perl program via system
is simple. 现在,通过system
从Perl程序中使用它很简单。
my $exit_status = system('start /MIN second_application.exe');
Note that this does not work if the program was already running. 请注意,如果程序已经在运行,则此方法将无效。
Source: tech-recipes.com 资料来源: tech-recipes.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.