繁体   English   中英

在Windows 10上使用命令行或Powershell关闭“此PC”

[英]Close “This PC” using command line or Powershell on Windows 10

如果我在powershell中输入“ explorer”,它将打开“ This PC”。 如何使用命令行或Powershell脚本关闭“此PC”?

您试图通过没有启动位置的PowerShell启动'explorer.exe'来完成什么工作?

您正在运行什么操作系统? 在Win10上,这将在“快速访问”处打开。

您可以使用PowerShell将资源管理器打开到使用以下命令选择的任何目录

Invoke-Item -path SomeQuaifiedPath

# or 

ii SomeQualifiedPath

您当然可以获取给定进程的主窗口名称及其ID,并使用Stop-Process cmdlet通过任一属性将其停止。

Get-Process | 
Where-Object -FilterScript {
    $PSItem.MainWindowHandle -ne 0 
} |
Select-Object -Property Name, Description, MainWindowTitle, Company, ID |
Out-GridView -Title 'Choose Application to Kill' -PassThru | 
Stop-Process -Force -Confirm:$true

这对我有用

Start-Process Explorer
$explorerID = (Get-Process Explorer).Id
Stop-Process -Id $explorerID

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM