我怎样才能在一个特定的位置打开一个cmd窗口,而不必一直导航到我想要的目录?


当前回答

为了在windows系统中获得更好的终端使用体验,可以使用cmder作为快捷方式:

下载cmder到你的系统 使快捷方式 type path_of_the_cder /START target_path_wish_to_run . type path_of_the_cder /START

例如:

\用户\<用户名>i\AppData\漫游\ cder \ cder .exe /START C:\SOURCE\

其他回答

在Windows 8系统中,你可以点击地址栏,输入“cmd”(不带引号),然后回车。这将在当前路径中打开cmd窗口。

这个程序总是在浏览器的当前路径下打开cmd.exe: https://github.com/jhasse/smart_cmd

你也可以把它固定在你的任务栏上,然后使用WindowsKey+[1-0]作为键盘快捷键。

只需在地址栏中输入cmd,它将在当前文件夹中打开。

Windows 10文件资源管理器现在有一个“快速访问工具栏”。

只需按“Alt+F”打开文件菜单,导航到“打开Windows PowerShell”菜单,右键单击并选择“添加到快速访问工具栏”:

现在你会看到一个你可以点击的小图标,它会在你所在的目录下打开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上找到这个脚本