以管理員身份在當前目錄打開命令行窗口
這里要介紹如何在右鍵菜單里添加一個菜單選項讓我們可以在一個文件夾里直接右擊鼠標便可以管理員身份打開一個命令行窗口,那樣的話將會讓工作變得非常輕松。
將以下代碼復制到一個文本文件,然后保存成 cmd.reg,注意文件后綴是reg,注冊表文件。
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\""
然后雙擊運行,彈出確定對話框,點擊確定,再右鍵一看,菜單里已經多出一個以管理員身份打開命令行窗口的選項了。
如何去除:
假如哪天你不想要這個新加的選項了,請把下面的代碼復制,同樣保存到一個文本文件然后存為remove.reg,雙擊運行之。選項就會消失,菜單恢復正常。
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]