簡體   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