您的位置:首頁 > 軟件資訊 > 編程技巧 > 操作系統(tǒng)
來源:北大青鳥飛迅校區(qū)|發(fā)布時間:2013-05-03 10:14:18
此文僅限于對經(jīng)常需要打開命令行并且感到正常打開命令行方式很浪費(fèi)時間的人.
正常情況下我門需要打開CMD, 然后再CD到自己需要的目錄, 這對偶爾用用的人倒沒什么. 但是經(jīng)常需要這么些操作就感到浪費(fèi)了大把時間. 現(xiàn)在提供兩種方式讓你像在linux中那樣更高效的在當(dāng)前目錄打開命令行.
方式一:
在當(dāng)前目錄按Shift+鼠標(biāo)右鍵, 你就可以看到類似的在此處打開命令行的選項了, 如果你想去掉shift,直接按鼠標(biāo)右鍵就有此選項, 那么你需要用簡單的修改下你的注冊表,
去注冊表位置HKEY_CLASSES_ROOTDirectoryshellcmd 下面將Extended鍵值刪掉, 如果你還希望驅(qū)動器和桌面也能這樣, 將HKEY_CLASSES_ROOTDrivershellcmd和
HKEY_CLASSES_ROOTDirectoryBackgroundshellcmd 下的Extended鍵值去掉即可.
方式二:
用快捷鍵,當(dāng)然會用到人見人愛的Autohotkey. 其Auothotkey代碼如下:
SetTitleMatchMode RegEx
return
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
; open ‘cmd’ in the current directory
;
#c::
OpenCmdInCurrent()
return
#IfWinActive
; Opens the command shell ‘cmd’ in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
; This is required to get the full path of the file from the address bar
WinGetText, full_path, A
; Split on newline (`n)
StringSplit, word_array, full_path, `n
; Take the first element from the array
full_path = %word_array1%
; strip to bare address
full_path := RegExReplace(full_path, “地址: “, “”)
; Just in case – remove all carriage returns (`r)
StringReplace, full_path, full_path, `r, , all
IfInString full_path,
{
Run, cmd /K cd /D “%full_path%”
}
else
{
Run, cmd /K cd /D “C: ”
}
}
把上面代碼存為UTF-8編碼格式(因為有中文)的ahk格式,用Autohotkey打開,然后按win鍵+C就可以在當(dāng)前目錄下打開cmd命令行了.
這段小代碼肯能有兩個你需要修改的地方
1. #c:: 中的#代表win鍵, 這個代碼中使用的是win鍵+C, C可以改成你需要的其它鍵
2. 如果你的系統(tǒng)是英文的,你需要把”地址: ” 改為 “^Address: “
全程面授,不高薪都難
申請成功后,我們將在24小時內(nèi)與您聯(lián)系
招生熱線: 4008-0731-86 / 0731-82186801
學(xué)校地址: 長沙市天心區(qū)團(tuán)結(jié)路6號
Copyright © 2006 | 湖南大計信息科技有限公司 版權(quán)所有
湘ICP備14017520號-3