简体   繁体   English

如何在Windows上运行从Perl最小化的程序?

[英]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.

相关问题 无法从 Windows 任务栏恢复最小化的程序 - Cannot restore minimized program from Windows Taskbar 如何从 windows 命令提示符在虚拟环境中运行 python 程序? - How do I run a python program in a virtual environment from windows command prompt? 如何运行在 windows 中安装了 pip 的程序? - How do I run a program installed with pip in windows? 如何让我的 C 程序在 windows 的后台运行? - How do i make my C program run in the background on windows? 如何从 Perl 创建然后使用长的 Windows 路径? - How do I create then use long Windows paths from Perl? 如何使用批处理文件在Windows下为Perl程序创建快捷方式? - How do I make a shortcut for a Perl program under Windows using a batch file? 如何从 Windows 命令提示符开始运行 Window(Windows 键 + R)? 我还想定义 WHAT 程序 Run 应该在同一命令中打开 - How do I start Run Window (Windows key + R) from Windows Command Prompt? I also want to define WHAT program Run should open in the same command 如何在不在脚本路径前键入“perl”的情况下从Cmd运行Perl脚本? - How Do I Run a Perl Script from Cmd without typing “perl” in front of the script path? 如何在Windows上修复“perl未被识别”? - How do I fix “perl is not recognized” on Windows? 如何在 Windows 上调用 Perl 脚本? - How do I invoke a Perl script on Windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM