我想使用PowerShell获取计算机上当前正在运行的进程的位置。使用PowerShell获取进程位置路径
例
C:\Program Files (x86)\Mozilla Firefox
C:\Windows\sysWOW64\WindowsPowerShell\v1.0
C:\Program Files (x86)\Internet Explorer
当我运行命令
$path = Get-Process | Select-Object Path
Split-Path $path
我得到下面的输出,这是我不是我想要的。为什么添加@ {Path =?
@{Path=C:\Program Files (x86)\Mozilla Firefox
@{Path=C:\Windows\sysWOW64\WindowsPowerShell\v1.0
@{Path=C:\Program Files (x86)\Internet Explorer
当我运行Split-Path
如下,它给了我正确的输出C:\Windows\sysWOW64\WindowsPowerShell\v1.0
。
$pshpath = "C:\Windows\sysWOW64\WindowsPowerShell\v1.0\powershell.exe"
Split-Path $pshpath