Cygwin在開啟在當前目錄

2021-07-27 05:22:16 字數 1234 閱讀 3702

前段時間搗鼓linux, 有時切換到windows時,也習慣了linux命令,於是就裝了cygwin,

在win7上按住shift時右鍵乙個「open command window here", 為了方便,就想在這裡新增乙個open cygwin的選單,

不過新增登錄檔選單 後還是發現cygwin啟動後開啟的時home目錄,後來發現cygwin啟動時加了login引數就會進入home目錄,試了幾種辦法,無果

今天 在環境變數裡加了個home發現,cygwin的home也被改了,想到既然cygwin可以讀取系統變數,把這樣可以把啟動的目錄 儲存在系統變數中,然後

cd $t就可以開啟啟動目錄 了,這樣好歹也比以前方便點 ,於是就開始動手了,後來發現可以直接用shell指令碼 來執行cd,於是完整的開啟當前目錄就搞定了

下面是我的登錄檔(不想按shift的可以去年extended那行) 

1 windows registry editor version 5.00

2 3 

[hkey_classes_root

\directory\background\shell\cygwin]

4 @="open &cygwin"

5 "extended"=""

6 7 

[hkey_classes_root

\directory\background\shell\cygwin\command]

8 @="c

:\\cygwin

\\cygwin

.bat %v"9 

修改cygwin.bat如下:

1 @echo

off2 

set_t=%*

3 c:

4 chdir c:\cygwin\bin

5 6 

bash --login -i

然後修改cygwin下.bash_profile執行cd命令

43 44 

export

_t=$

# replace backslash to fowardslash

45 if 

[[$_t

==""]];

then

46     export

_t="

c:/users/administrator

"47 

fi48 cd"

$_t"

這樣右鍵選單裡就多了個open cygwin了,很爽啊,拋棄難用的cmd吧

Mac 在當前目錄開啟終端

在當前目錄開啟終端在windows中非常簡單,mac上則需要一些配置。主要有兩種方式,一種是系統自帶,一種是用第三方工具。依次點選訪達選單上的訪達 服務 服務偏好設定.在列表中勾選上新建位於檔案位置的終端視窗 可以設定個快捷鍵,但需要注意衝突問題,衝突了是無法生效的。選中資料夾,右鍵列表中選中服務 ...

win10 在當前目錄下 開啟cmd

windows7 按住 shift 鍵 右鍵 就有該選項。windows10 執行下面的 登錄檔檔案 該登錄檔檔案內容如下 windows registry editor version 5.00 hkey classes root directory shell runas open cmd he...

win10 在當前目錄下 開啟cmd

windows7 按住 shift 鍵 右鍵 就有該選項。windows10 執行下面的 登錄檔檔案 該登錄檔檔案內容如下 windows registry editor version 5.00 hkey classes root directory shell runas open cmd he...