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