【发布时间】:2019-07-31 23:07:47
【问题描述】:
使用Start-Process,当使用Verb时,Workingdirectory选项不起作用,新的powershell总是以C:\WINDOWS\system32开头。为什么是这样?如果没有额外的 cd 命令,我怎么能做到这一点?
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.0
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.0
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\> Start-Process -FilePath powershell.exe -Verb Runas -WorkingDirectory C:\ws\
# the new ps shell always in system32:
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\WINDOWS\system32> pwd
Path
----
C:\WINDOWS\system32
【问题讨论】:
标签: powershell windows-10