2010-10-31 05:54:15 +0000 2010-10-31 05:54:15 +0000
116
116
Advertisement

如何用键盘快捷键打开当前文件夹的命令提示符?

Advertisement

在Windows7中如何用键盘快捷键打开当前文件夹中的命令提示符?
有什么方法可以实现吗?
我觉得Autohotkey可以做到这一点,但不知道如何实现。

Advertisement
Advertisement

Réponses (11)

122
122
122
2010-10-31 06:53:07 +0000

使用此键盘快捷方式。Shift + Menu, W, Enter

  1. Shift + Menu (或者 Shift + F10), (打开当前文件夹中的右键菜单)

  2. W (选择 “在这里打开命令窗口”),

  3. 回车(激活选择;由于 “新建 "也可以用W选择,所以需要用到)

这个快捷键是指微软推出的特殊键,通常是在Win键右侧的右侧。你只需要按Win + C**(或者你想定义为什么就按什么):

SetTitleMatchMode RegEx
return

; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass

    ; create new text file
    ;
    #t::Send !fwt

    ; open 'cmd' in the current directory
    ;
    #c::
        OpenCmdInCurrent()
    return
#IfWinActive

; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
    ; This is required to get the full path of the file from the address bar
    WinGetText, full_path, A

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n

    ; Find and take the element from the array that contains address
    Loop, %word_array0%
    {
        IfInString, word_array%A_Index%, Address
        {
            full_path := word_array%A_Index%
            break
        }
    }  

    ; strip to bare address
    full_path := RegExReplace(full_path, "^Address: ", "")

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all

    IfInString full_path, \
    {
        Run, cmd /K cd /D "%full_path%"
    }
    else
    {
        Run, cmd /K cd /D "C:\ "
    }
}

作为奖励,上面的脚本还可以用这个快捷方式创建一个新的文本文件。Win + T

归功于: Eli Bendersky

120
120
120
2011-05-27 13:53:05 +0000

按Alt+D,输入cmd,然后按回车键。更多详情请看博文这里

42
Advertisement
42
42
2010-10-31 06:25:07 +0000
Advertisement

在windows7中,类似的操作方法是按住shift键,同时按住鼠标右键到你要 “命令提示符 "的文件夹上,在你的上下文菜单中会出现一个新的菜单项,提供给你的正是这样的操作。"如果你想要纯键盘操作,那么你必须这样做:

  • 打开regedit
  • 打开HKEY_CLASSES_ROOT\Directory\shell\cmd
  • 转到Extended,将Extended_save键重命名为HKEY_CLASSES_ROOT\Drive\shell\cmd
  • 转到Extended key to,将`

this adds the "open command window here” entry to the context menu permanently. you can trigger this entry by pressing:

  • alt
  • let go, context menu opens
  • press the “underscored” character of the “open command window here” entry or go down with your cursor keys and hit enter

the name of the menu entry is labled according to the language of your OS.

an alternative route is to do this:

  • open the folder you want in the command prompt via the explorer
  • f4
  • ctrla
  • ctrlc
  • winr
  • Extended_save ctrlventer

which grabs the current path from the address bar of explorer and executes cmd /k cd&007cmd /k cd PATH。用autohotkeys你也可以这样做,但我不知道autohotkeys。

9
9
9
2016-07-31 04:20:11 +0000

來自 how-to-open-cmd-in-current-folder-by-shortcut-windows-10

如果你使用的是Windows 8/10,有一个更快、更原始的方法:

Alt + F, P

只需三键输入两遍,无需其他程序的帮助。

3
Advertisement
3
3
2018-02-08 03:24:22 +0000
Advertisement

在最新的Windows 10更新中,Leftium的答案中的Shift+菜单,W的方法已经不能用了。

问题是,在扩展右键菜单中不再有命令提示符。

Shift +菜单,S打开目标文件夹中的Windows Powershell。进入Windows Powershell后,键入cmd,然后按回车键。

P.S.

Ashwin Nanjappa的方法是Ctrl + L,键入cmd,然后按回车键就可以了。然而,只有当你不打算返回到Windows资源管理器窗口继续在目录间导航时,这种方法才是优雅的。不幸的是,这种方法会把你在Windows资源管理器中的光标带离主窗口,需要多次按Tab键才能回到你可以使用方向键导航文件夹的地方。

虽然Windows Powershell在大多数方面的工作方式与Command Prompt相同,但我至少遇到过一次Windows Powershell错误地误读了我的@tags(当我生成javadocs时),而没有产生预期的结果。通过在Windows Powershell中输入cmd,然后回车,你可以使用Command Prompt来代替,这样就可以克服这些问题。

2
2
2
2016-06-03 02:43:11 +0000

最简单的方法是在windows资源管理器地址栏中输入cmd,它会立即从该位置打开命令提示符。

1
Advertisement
1
1
2018-12-28 11:59:57 +0000
Advertisement

一个比选择题更简单的AHK脚本

#c::cmdHere()

cmdHere() {
    If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") {
        WinHWND := WinActive()
        For win in ComObjCreate("Shell.Application").Windows
            If (win.HWND = WinHWND) {
                dir := SubStr(win.LocationURL, 9) ; remove "file:///"
                dir := RegExReplace(dir, "%20", " ")
                Break
            }
    }
    Run, cmd, % dir ? dir : A_Desktop
}
``` &001 


来源:[ https://autohotkey.com/boards/viewtopic.php?t=5796 ](https://autohotkey.com/boards/viewtopic.php?t=5796)
1
1
1
2011-10-15 16:35:43 +0000

使用@Ashwin的方法

使用Win P

#P::
{
    Send !D
    Send powershell
    Send {Enter}    
    return
}

使用Win C

#C::
{
    Send !D
    Send CMD
    Send {Enter}    
    return
}
``` 打开Powershell控制台打开命令提示符
0
Advertisement
0
0
2014-06-27 14:16:11 +0000
Advertisement

如果你使用的是德语版的Windows,你可以这样做:

按Alt+D,E

Alt+D会打开一个菜单,除了cmd之外,你还可以选择一些其他的东西。

0
0
0
2020-02-23 19:48:34 +0000

PowerShell OpenHere 模块怎么样?

运行PowerShell权限提升后的权限和类型:

Install-Module OpenHere
Set-OpenHereShortcut -ShortcutType:CMD

免责声明:

我是这个模块的开发者。

-1
-1
-1
2018-05-14 14:52:16 +0000

对于AHK,以下是我的绑定:

#c::
Run, C:\Windows\system32\cmd.exe
return

&001

这并不能打开当前文件夹,但很方便。

Advertisement

Questions connexes

3
19
10
28
3
Advertisement