Windows 10 right-click to add "Open command window here"

I used Powershell to run the code today, and I couldn't find an environment variable, so I had no choice but to go back to the cmd command line to test, and it ran right away. -_-|| 

Since the default right key of Win10 is only Powershell now, for the convenience of future use, I will share the code of adding "Open command window here" to the right key. (#^.^#)

Effect

The first is to right-click directly on the desktop/folder window/selected folder to display the "Open command window here" option, as shown in the figure: 
write picture description here 
The second is in the desktop/folder window/selected folder Hold down the Shift key and right-click, and two options, "Open Command Window Here" and "Open Powershell Window Here" are displayed at the same time, as shown in the figure: 
write picture description here

Specific steps

Step 1: Create a new txt file and name it OpenCmdHere.txt 
Step 2: Enter the following code in the file and save it

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere]
@="Open command prompt here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="Open command window here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere]
@="Open command window here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere]
@="Open command window here"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHere\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""

 

Step 3: Change the file suffix to reg, and the pop-up prompt is clicked to confirm. 
Step 4: Double-click the OpenCmdHere.reg file to run, the pop-up prompt point to confirm, modify the registry and you're done!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324883745&siteId=291194637