当我们不确定一条PowerShell会带来什么样的结果的时候,我们可以用“-whatif”来测试一下;

(1)运行“mspaint”,可以看到“mspaint”进程在运行;

(2)我们可以看看“stop-process –name “mspaint””会带来什么样的结果;

输入“stop-process –name “mspaint” -whatif”;

powershell提示“Performing the operation “stop-process” on target “mspaint(2892)””;

这个提示是对“stop-process –name “mspaint””的解释

(3)事实上powershell并不会执行“stop-process –name “mspaint””这条命令;

我们再次查询进程的时候,它仍然在运行;

p_w_picpath