我怎样才能在一个特定的位置打开一个cmd窗口,而不必一直导航到我想要的目录?
当前回答
如果您使用的是Windows Vista或更高版本,请按住Shift键右键单击资源管理器中的文件夹图标,然后单击“在此打开命令窗口”或“在此打开PowerShell窗口”上下文菜单选项。
如果你已经在你想要的文件夹中,你可以执行以下操作之一:
[only Win8+] Click the Explorer Ribbon's File button, then click on "Open command window here" or "Open PowerShell window here". Shift-right-click on 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-F to open the File menu, plus Shift.
对于Windows XP,使用dF提到的PowerToy来获得相同的功能。
其他回答
试试微软的这个“强力玩具”吧:
此处打开命令窗口 这个PowerToy增加了一个“打开命令” “窗口此处”上下文菜单选项打开 文件系统文件夹,给你一个 快速打开命令窗口的方法 (cmd.exe)指向所选的 文件夹中。
编辑:此软件将不能工作在任何版本的Windows除了Windows XP。
从Windows 7到某些版本的Windows 10,在任何你想要的地方打开命令提示符都非常简单,而不需要使用命令“cd”进行导航。 试试下面这个。 按住Shift键点击鼠标右键。
它会产生这样一个选项。然后只需选择“此处打开命令窗口”选项。 最新版本的Windows 10已经将此功能替换为“此处打开Powershell”。
我刚刚看到这个问题,无法帮助发布我的自动热键脚本在Windows XP上的cmd。您可以在脚本中找到热键。好的事情是,当你当前的窗口是资源管理器时,cmd将在地址栏显示的路径中打开。
我把这个脚本保存在存放所有绿色工具(包括自动热键)的文件夹中。对于一台新机器,我只需复制文件夹,双击脚本将.ahk与AutoHotkey关联起来,并在启动文件夹中创建一个快捷方式。它比安装PowerToys还要快。
; Get working folder
GetWorkingFolder() {
if WinActive("ahk_class ExploreWClass") or WinActive("ahk_class CabinetWClass") {
ControlGetText, path, Edit1
return %path%
} else if WinActive("FreeCommander") {
Send, {CTRLDOWN}{ALTDOWN}{INS}{ALTUP}{CTRLUP}
Sleep, 100
return clipboard
} else {
return "C:\"
}
}
#IfWinActive,
#c::
path := GetWorkingFolder()
Run, %ComSpec%, %path%
return
; PowerShell
#+C::
path := GetWorkingFolder()
Run, %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe, %path%
return
#^c::
Run, %ComSpec%, %temp%
return
#!c::
path := GetWorkingFolder()
Run, %comspec% /k "%VS90COMNTOOLS%vsvars32.bat", %path%
return
; irb
#!b::
path := GetWorkingFolder()
Run, c:\cygwin\bin\ruby /usr/bin/irb, %path%
return
; Bash
#b::
path := GetWorkingFolder()
Run, bash --login, %path%
return
; Paste in console
+INS::
if WinActive("ahk_class ConsoleWindowClass") {
WinGetPos, x, y, w, h, A
MouseGetPos, mx, my
;MsgBox x=%x% y=%y% w=%w% h=%h% mx=%mx% my=%my%
if (mx < 10)
mx = 10
else if (mx > w - 30)
mx := w - 30
if (my < 40)
my = 40
else if (my > h)
my := h - 10
MouseClick, right, mx, my
}
return
对于任何感兴趣的人,你可以在github上的rwin上找到这个脚本
你还可以这样做:
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="command prompt here"
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /c start \"%1\" cmd.exe /k cd /d %1"
[HKEY_CLASSES_ROOT\Drive\shell\cmd]
@="command prompt here"
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="cmd.exe /c start \"%1\" cmd.exe /k cd /d %1"
更新:Win10你需要ShowBasedOnVelocityId -见上面的答案。
在windows 10中,你只需要点击一下就可以在任何文件夹中获得cmd。 只需按住“shift +鼠标右键”在你想要的文件夹,cmd将打开你的文件夹路径。
推荐文章
- 在Sublime Text 2中使用Ctrl+D进行多个选择时,我如何跳过匹配?
- #定义WIN32_LEAN_AND_MEAN具体排除了什么?
- 最好的轻量级web服务器(只有静态内容)的Windows
- npm犯错!错误:EPERM:操作不允许,重命名
- 崇高的文本从命令行
- 如何保持Python脚本输出窗口打开?
- 使用.bat文件检查文件夹是否存在
- 如何查看Windows库(*.lib)的内容
- 在Windows中删除大文件夹最快的方法是什么?
- 顺序运行NPM脚本
- NPM卡住给出相同的错误EISDIR:对目录的非法操作,读取错误(本机)
- Windows 10环境变量太大
- 如何使用Windows命令行更改目录
- 如何在NERDTree中显示隐藏文件(以句点开始)?
- Objective-C for Windows