禁止从任务栏打印照片

禁止从任务栏打印照片

问题描述:

我正在编写一个Perl脚本,该脚本进行系统调用以终止正在运行的进程.例如,我想杀死所有PuTTy窗口.为此,我有:

I'm writing a Perl script that makes system calls to kill running processes. For instance, I want to kill all PuTTy windows. In order to do this, I have:

system('TASKKILL/F/IM油灰*/T 2> nul');

system('TASKKILL /F /IM putty* /T 2>nul');

但是,对于每个被杀死的进程,我都会看到一句话:

For each process that's killed, however, I get a print saying

成功:PID xxxx子级为PID xxxx的子进程已终止.

SUCCESS: The process with PID xxxx child of PID xxxx has been terminated.

这使我的CLI混乱.消除这些印刷痕迹的简便方法是什么?另外请注意,我正在Cygwin中执行这些脚本.

which is cluttering my CLI. What's an easy way to eliminate these prints? Also note, that I'm executing these scripts in Cygwin.

重定向sderr-> stdout-> nul:

Redirect sderr->stdout->nul:

system('TASKKILL /F /IM putty* /T 1>nul 2>&1');

或者只是简单地获取输出:

or just simply grab output:

my $res = `TASKKILL /F /IM putty* /T 2>nul`;