[英]How can I change directory directly from the windows run prompt?
How can I change the current directory from the the windows run
prompt when we initialize powershell as powershell
.当我们将 powershell 初始化为
powershell
时,如何从 windows run
提示更改当前目录。 For eg: powershell --someArgs
例如:
powershell --someArgs
Launch cmd.exe
and use the builtin start
command's /d
flag to launch powershell.exe
with a specific working directory:启动
cmd.exe
并使用内置start
命令的/d
标志启动具有特定工作目录的powershell.exe
:
cmd /c start /d "C:\working\directory\goes\here" powershell.exe
This will set the working directory of the powershell.exe
process to C:\working\directory\goes\here
, in turn causing PowerShell's $PWD
to change to that directory这会将
powershell.exe
进程的工作目录设置为C:\working\directory\goes\here
,进而导致 PowerShell 的$PWD
更改为该目录
You can use Set-Location or Cd您可以使用 Set-Location 或 Cd
Powershell.exe -noexit -Command "CD 'C:\Test\'"
Powershell.exe -noexit -Command "Set-Location 'C:\Test\'"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.