Windows Tip-A shortcut to open CMD in a directory
There are often situations where cmd needs to be used in a folder at work, such as running a script. Here are a few ways to do it.
Take the following directory operations as an example:
Method 1: Common cd command
The cd command is the way we usually use it:
Win+R opens cmd window, default display is as follows (non-administrator mode);
You need to type e: cd github cd anyer cd Wechat-Weapp
or e: cd github\anyer\WeChat-WeApp\
or cd E:\github\anyer\WeChat-WeApp\(type another one if not in the specified directory)
3. to operate.
Method 2: shortcut of right mouse button
Obviously experienced the above multiple commands, is not feeling very worried, here is a shortcut:
Win +E Explorer quickly enters the specified directory;
Shift + right mouse button to open the Options menu
Select the Open command window here item;
3. to operate.
The above method only supports cmd with current user (non-administrator) privileges. When administrator privileges are required, you can try the following method.
Run the command line window by right-clicking Add Administrator mode, copy the code using the following code, and save it as an arbitrary name.reg, i.e., as a registry file.
Windows Registry Editor Version 5.00; Created by: Shawn Brink; http://www.sevenforums.com; Tutorial: http://www.sevenforums.com/tutorials/47415-open-command-window-here-administrator.html[-HKEY_CLASSES_ROOT\Directory\shell\runas][HKEY_CLASSES_ROOT\Directory\shell\runas]@="Open cmd here as Admin""HasLUAShield"=""[HKEY_CLASSES_ROOT\Directory\shell\runas\command]@="cmd.exe /s /k pushd \"%V\""[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas][HKEY_CLASSES_ROOT\Directory\Background\shell\runas]@="Open cmd here as Admin""HasLUAShield"=""[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]@="cmd.exe /s /k pushd \"%V\""[-HKEY_CLASSES_ROOT\Drive\shell\runas][HKEY_CLASSES_ROOT\Drive\shell\runas]@="Open cmd here as Admin""HasLUAShield"=""[HKEY_CLASSES_ROOT\Drive\shell\runas\command]@="cmd.exe /s /k pushd \"%V\""
After saving, double-click this file, that is, right-click to add options:
When you want to delete the right-click menu option, you can use the following command, copy and save as any name.reg, and double-click Run.
Windows Registry Editor Version 5.00 ; Created by: Shawn Brink ; http://www.sevenforums.com; Tutorial: http://www.sevenforums.com/tutorials/47415-open-command-window-here-administrator.html [-HKEY_CLASSES_ROOT\Directory\shell\runas] [-HKEY_CLASSES_ROOT\Directory\Background\shell\runas][-HKEY_CLASSES_ROOT\Drive\shell\runas] Mode 3: Resource Manager (Added 2017-08-08)
After entering cmd or powershell carriage in the address bar of the resource manager, you can still quickly open a command line window in the current directory:
1. Enter specified directory
2. Enter cmd or powershell in the address bar
3. Enter confirmation
Method 4: git command line
For users who use git in this way, make sure to install git bash command line when installing git, to ensure that git operation can be completed from command line ~. Windows installation git tutorial self Baidu. After installation, use git bash instead of cmd in directories where cmd is required.
1. resource manager enters the specified directory;
2. Right mouse button, select Git Bash Here item from menu item;
3. to operate;
Other ways, supplement after follow-up understanding ~