由於最近使用cmd比較多,就想在某個文件夾下右鍵打開cmd,這樣就省事多了。win10默認可以“shift+右鍵”打開cmd,但只能打開powershell。於是就多方查找,自己整了一個。
首先是新建一個reg_cmdhere.reg文檔,右鍵,用notepad++打開,輸入
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\cmdhere]
@="Cmd&Here"
[HKEY_CLASSES_ROOT\*\shell\cmdhere\command]
@="\"C:\\Windows\\System32\\cmd.exe\" "
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
@="Cmd&Here"
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]
@="\"C:\\Windows\\System32\\cmd.exe\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here]
@="在此處打開命令行"
"Icon"="cmd.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here\command]
@="\"C:\\Windows\\System32\\cmd.exe\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmdPrompt]
@="在此處打開命令行"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmdPrompt\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"cd %1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here]
@="在此處打開命令行"
"Icon"="cmd.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here\command]
@="\"C:\\Windows\\System32\\cmd.exe\""
然後雙擊就註冊好了。在文件夾中右鍵和選中一個文件右鍵,都有cmdhere選項了。
如果要撤銷呢,怎麼辦,可以參考如下代碼
Windows Registry Editor Version 5.00
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_here\command]