小编ppi*_*rek的帖子

如何在 PowerShell 中启动和停止进程?

这应该在 3 岁以上的 PowerShell 中正常工作。我需要运行两个进程:wuapp.exe 和带有 ScreenSaver 选项卡的 desk.cpl。我遇到的问题是,一旦我启动 wuapp.exe,进程名称就会在任务管理器中显示为 explorer.exe - 当前代码适用于 wuapp.exe,但不适用于每台机器。另一件事是当我杀死 rundll32 时,其他应用程序也会关闭。你有什么建议?

$wshell = New-Object -ComObject Wscript.Shell
Start-Process  wuapp.exe
(New-Object -comObject Shell.Application).Windows() | foreach-object {$_.quit()}
Start-Process rundll32 desk.cpl,InstallScreenSaver
Stop-Process -ProcessName rundll32* -Force
Run Code Online (Sandbox Code Playgroud)

powershell start-process

1
推荐指数
1
解决办法
8123
查看次数

标签 统计

powershell ×1

start-process ×1