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


当前回答

在我的情况下,我非常特别想在特定文件夹的管理模式下打开CMD窗口。以下是如何(适用于Windows 7):

在目标文件夹中,创建START.BAT,只包含一行:

  start cd c:\MyTargetFolder

从START. bat中拖动快捷方式,并将其命名为“START AS ADMIN”。

右键单击快捷方式,选择“以管理员身份运行”和“最小化运行”。还要确保“Start In”将导致相同的驱动器被选中(因为CD不会改变驱动器!)

当您单击该快捷方式时,您将得到UAC提示符,然后在所需文件夹中打开命令窗口。标题栏将显示此CMD窗口处于ADMINISTRATOR模式。

其他回答

创建一个快捷方式,并编辑快捷方式的“Start In”属性到您想要cmd.exe启动的目录。

使用/K开关。例如

cmd /K "cd /d c:\WINDOWS\"

将创建一个cmd窗口在C:\Windows目录

最简单的方法是进入Windows资源管理器的地址栏,在那里输入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来获得相同的功能。

如果你使用全面指挥官,在底部有一个字段。它显示您当前所在的活动目录,并将在该目录中运行输入的命令。