[英]How can I change directory directly from the windows run prompt?
当我们将 powershell 初始化为powershell
时,如何从 windows run
提示更改当前目录。 例如: powershell --someArgs
启动cmd.exe
并使用内置start
命令的/d
标志启动具有特定工作目录的powershell.exe
:
cmd /c start /d "C:\working\directory\goes\here" powershell.exe
这会将powershell.exe
进程的工作目录设置为C:\working\directory\goes\here
,进而导致 PowerShell 的$PWD
更改为该目录
您可以使用 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.