简体   繁体   English

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

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

相关问题 如何更改 Windows 命令提示符中的文本颜色 - How can I change the text color in the windows command prompt 我可以在Windows服务中运行另一个命令提示符/ GUI进程吗? - Can I run another Command Prompt/GUI process in a Windows Service? 在Windows命令提示符下,如果没有输入,如何在一定时间内运行一个命令,如果没有输入,又如何运行? - In Windows Command prompt, how can I run one command if there is no input, and another if there is, within a certain time? Windows上的节点安装 - 无法从命令提示符运行NPM - Node installation on Windows - Can't run NPM from command prompt 如何从命令提示符快速打开当前目录? 操作系统 - Windows - How to quickly open the current directory from the command prompt? OS - Windows 如何在命令提示符下更改我的Windows显示用户名? - How can I change my windows display user name in command prompt? 如何从 windows 命令提示符在虚拟环境中运行 python 程序? - How do I run a python program in a virtual environment from windows command prompt? 如何在Windows机器上从命令提示符运行PHP程序? - How to run a PHP program from command prompt on a Windows Machine? 如何从 Windows 中的特定目录运行命令? - How to run a command from specific directory in Windows? 如何更改 Windows 中的命令行提示符? - How do I change the command-line prompt in Windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM