繁体   English   中英

如何直接从 windows 运行提示符更改目录?

[英]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.

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