windows 如何在特定位置打开 cmd 窗口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/60904/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I open a cmd window in a specific location?
提问by Haim Bender
How can I open a cmd window in a specific location without having to navigate all the way to the directory I want?
如何在特定位置打开 cmd 窗口而不必一直导航到我想要的目录?
采纳答案by dF.
You may want to look at this "PowerToy" from Microsoft:
你可能想看看微软的这个“PowerToy”:
Open Command Window Here
This PowerToy adds an "Open Command Window Here" context menu option on file system folders, giving you a quick way to open a command window (cmd.exe) pointing at the selected folder.
在此处打开命令窗口
此 PowerToy 在文件系统文件夹上添加了“在此处打开命令窗口”上下文菜单选项,让您可以快速打开指向所选文件夹的命令窗口 (cmd.exe)。
EDIT :This software will not function on a version of Windows earlier or later than Windows XP.
编辑:此软件将无法在早于或晚于 Windows XP 的 Windows 版本上运行。
回答by Allain Lalonde
This might be what you want:
这可能是你想要的:
cmd /K "cd C:\Windows\"
Note that in order to change drive letters, you need to use cd /d
. For example:
请注意,为了更改驱动器号,您需要使用cd /d
. 例如:
C:\Windows\System32\cmd.exe /K "cd /d H:\Python\"
回答by Michael Ratanapintha
If you have Windows Vista or later, right-click on the folder icon in Explorer while holding the Shift key, and then click on the "Open command window here" or "Open PowerShell window here" context menu option.
如果您使用的是 Windows Vista 或更高版本,请在按住 Shift 键的同时右键单击资源管理器中的文件夹图标,然后单击“在此处打开命令窗口”或“在此处打开 PowerShell 窗口”上下文菜单选项。
If you're already in the folder you want, you can do one of the following:
如果您已经在所需的文件夹中,则可以执行以下操作之一:
- [only Win8+] Click the Explorer Ribbon's File button, then click on "Open command window here" or "Open PowerShell window here".
- Shift-right-clickon the background of the Explorer window, then click on "Open command window here" or "Open PowerShell window here". (recommended by Kate in the comments)
- [only Vista or Win7] Hold down Shift when opening the Explorer File menu, then click on "Open command window here". If you can't see the menu bar, open the File menu by pressing Alt-Shift-F- Alt-Fto open the File menu, plus Shift.
- [仅限 Win8+] 单击资源管理器功能区的文件按钮,然后单击“在此处打开命令窗口”或“在此处打开 PowerShell 窗口”。
- Shift-right-click在资源管理器窗口的背景上,然后单击“在此处打开命令窗口”或“在此处打开 PowerShell 窗口”。(凯特在评论中推荐)
- [仅限 Vista 或 Win7] 打开资源管理器文件菜单时按住 Shift,然后单击“在此处打开命令窗口”。如果看不到菜单栏,请按Alt- Shift- F- Alt-F打开文件菜单,打开文件菜单,加上Shift。
For Windows XP, use the PowerToy mentioned by dFto get the same function.
对于 Windows XP,使用 dF 提到的 PowerToy可以获得相同的功能。
回答by san1deep2set3hi
Assuming that in File Explorer you have opened the target directory/folder, do this:
假设您在文件资源管理器中打开了目标目录/文件夹,请执行以下操作:
Click on address bar, alternatively press Alt+D
Now when address bar is highlighted, type cmdin the bar.
Press Enter key
点击地址栏,或者按Alt+D
现在,当地址栏突出显示时,在栏中键入cmd。
按回车键
You will notice that command prompt from that folder
您会注意到该文件夹中的命令提示符
回答by Don Chakkappan
From Windows 7 up to some versions of Windows 10, it is very simple to open a command prompt anywhere you wish, without navigation using command "cd". Try the following one. Click the mouse's right button by holding Shiftkey .
从 Windows 7 到 Windows 10 的某些版本,在您希望的任何位置打开命令提示符都非常简单,无需使用命令“cd”进行导航。尝试以下一种。按住Shift键单击鼠标右键。
It will produce an option like this. Then simply select the "Open command window here " option. The latest versions of Windows 10 have replaced this feature with "Open Powershell here".
它将产生这样的选项。然后只需选择“在此处打开命令窗口”选项。最新版本的 Windows 10 已将此功能替换为“在此处打开 Powershell”。
回答by desmati
On Windows Vista, Windows 7 and Windows 10 simply hold down the Shiftkey and right-click on a folder.
在 Windows Vista、Windows 7 和 Windows 10 上,只需按住Shift键并右键单击文件夹即可。
The context menu will contain an entry titled: "Open command window here"
上下文菜单将包含一个标题为:“在此处打开命令窗口”的条目
Update:Type "cmd" in the address bar of Explorer and press enter
更新:在资源管理器的地址栏中输入“cmd”并按enter
Update 2:In windows 10, go to file menu and select "Open Windows PowerShell". There is an option for running as administrator.
更新 2:在 Windows 10 中,转到文件菜单并选择“打开 Windows PowerShell”。有一个以管理员身份运行的选项。
回答by Jason Punyon
Use the /K switch. For example
使用 /K 开关。例如
cmd /K "cd /d c:\WINDOWS\"
Will create a cmd window at the C:\Windows directory
将在 C:\Windows 目录下创建一个 cmd 窗口
回答by Guillermo
Just write cmd
in the address bar, it will open in the current folder.
只需cmd
在地址栏中写入,它将在当前文件夹中打开。
回答by Vinay
In windows go to folder location in file explorer remove path and type cmd and press enter. and path will open in cmd.
在 Windows 中,转到文件资源管理器中的文件夹位置,删除路径并键入 cmd 并按 Enter。路径将在 cmd 中打开。
回答by TiagoLr
Also, here is a shortcut to open a console in any windows folder:
此外,这是在任何 Windows 文件夹中打开控制台的快捷方式:
- Open any folder on windows explorer.
- Press
Alt + D
to focus the adress bar - type
cmd
and press enter
- 在 Windows 资源管理器上打开任何文件夹。
- 按
Alt + D
聚焦地址栏 - 输入
cmd
并按回车
Very practical shortcut.
很实用的捷径。