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


当前回答

为什么这么多的设置,对于这个简单的事情,当你在路径在cmd输入

start .

并按Enter

其他回答

对于windows 7或更高版本,在目标文件夹地址栏中键入cmd。就是这样。它将打开命令提示符,路径设置为当前目录。

试试微软的这个“强力玩具”吧:

此处打开命令窗口 这个PowerToy增加了一个“打开命令” “窗口此处”上下文菜单选项打开 文件系统文件夹,给你一个 快速打开命令窗口的方法 (cmd.exe)指向所选的 文件夹中。

编辑:此软件将不能工作在任何版本的Windows除了Windows XP。

我知道有个更简单的方法。在开始菜单中找到cmd.exe,并将其作为快捷方式发送到桌面。然后右键单击它并选择属性。你会在“目标”下看到“开始”框。将该目录更改为您想要设置的任何目录。单击“确定”并启动桌面上的cmd.exe。在我看来,这是一个非常简单和确定的解决方案:)

这将向上下文菜单添加条目,以启动一个自动导航到您所单击目录的命令窗口。

用法:

Right-click a folder icon (or the empty background area inside an already open folder)
and click either "Open in Terminal" or "Open in Terminal (Admin)".

You can also right click files to execute them with a command window.
When the file is done running you are left with a command window that is navigated to the files directory.

Open_in_Terminal.reg

Windows Registry Editor Version 5.00

; Admin versions.

; Right click on a folder in a directory.
[HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHereAsAdministrator]
@="Open in Terminal (Admin)"
"Icon"="cmd.exe"
"HasLUAShield"=""
"Position"="middle"
[HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHereAsAdministrator\command]
@="cmd.exe /c powershell.exe -Command \"Start-Process cmd -Verb runas -ArgumentList '/k pushd \"%1\"'\""

; Right click on nothing in a directory, i.e. the "background" of the directory.
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHereAsAdministrator]
@="Open in Terminal (Admin)"
"Icon"="cmd.exe"
"HasLUAShield"=""
"Position"="middle"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHereAsAdministrator\command]
@="cmd.exe /c powershell.exe -Command \"Start-Process cmd -Verb runas -ArgumentList '/k pushd \"%V\"'\""

; Right click on nothing in a library directory, i.e. the "background" of the library directory.
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHereAsAdministrator]
@="Open in Terminal (Admin)"
"Icon"="cmd.exe"
"HasLUAShield"=""
"Position"="middle"
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHereAsAdministrator\command]
@="cmd.exe /c powershell.exe -Command \"Start-Process cmd -Verb runas -ArgumentList '/k pushd \"%V\"'\""

; Right click on a file in a directory.
[HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindowAsAdministrator]
@="Open in Terminal (Admin)"
"Icon"="cmd.exe"
"HasLUAShield"=""
"Position"="middle"
[HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindowAsAdministrator\command]
@="cmd.exe /c powershell.exe -Command \"Start-Process cmd -Verb runas -ArgumentList '/k pushd \\\"%W \\\" && \\\"%1\\\"'\""

; Non-Admin versions.

; Right click on a folder in a directory.
[HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHere]
@="Open in Terminal"
"Icon"="cmd.exe"
"Position"="middle"
[HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHere\command]
@="cmd.exe /k pushd \"%1\""

; Right click on nothing in a directory, i.e. the "background" of the directory.
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHere]
@="Open in Terminal"
"Icon"="cmd.exe"
"Position"="middle"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHere\command]
@="cmd.exe /k pushd \"%V\""

; Right click on nothing in a library directory, i.e. the "background" of the library directory.
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHere]
@="Open in Terminal"
"Icon"="cmd.exe"
"Position"="middle"
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHere\command]
@="cmd.exe /k pushd \"%V\""

; Right click on a file in a directory.
[HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindow]
@="Open in Terminal"
"Icon"="cmd.exe"
"Position"="middle"
[HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindow\command]
@="cmd.exe /k pushd \"%W\" && \"%1\""

这需要很多努力,所以如果你觉得慷慨,然后随时发送一个贝宝捐赠,以帮助我克服调试和测试的创伤后应激障碍:)

一个卸载程序,如果你需要:

Open_in_Terminal_Remover.reg

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHereAsAdministrator]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHereAsAdministrator]
[-HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHereAsAdministrator]
[-HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindowAsAdministrator]
[-HKEY_CLASSES_ROOT\Directory\shell\OpenCommandWindowHere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCommandWindowHere]
[-HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\OpenCommandWindowHere]
[-HKEY_CLASSES_ROOT\*\shell\OpenWithCommandWindow]

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

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

现在你会看到一个你可以点击的小图标,它会在你所在的目录下打开PowerShell: