最近考慮使用 Windows Terminal 的多 Tab 頁。Windows Terminal 自從出來之後備受好評,功能簡單擴展性強,頗有 VS Code 的作風。
但是習慣了 Shift+右鍵 在此處打開命令窗口(在此處打開 Power Shell 窗口),就在想可不可以把右鍵菜單的 cmd 替換爲 Windows Terminal,並實現在此處打開的功能。
操作步驟
1、win+R 輸入 regedit
2、找到 計算機\HKEY_CLASSES_ROOT\Directory\Background\shell
3、右鍵 > 新建 > 項,名稱填寫 “在此處打開 Terminal”
4、在新建的 “在此處打開 Terminal” 上右鍵 > 新建 > 項,名稱填寫“command”,
將 (默認) 值修改爲 cmd /c set CURRENT_PATH="%V" & start C:\Users\admin\AppData\Local\Microsoft\WindowsApps\wt.exe
其中 C:\Users\admin\AppData\Local\Microsoft\WindowsApps\wt.exe
是 Windows Terminal 的可執行文件地址。
其實是設置了一個臨時的環境變量,使得 Windows Terminal 在運行的時候可以訪問到
在 Windows Terminal 中設置 powershell 的 startingDirectory 值爲 null 這樣新打開的 powershell 窗口就能獲得剛纔設置的 CURRENT_PATH 值了
測試,大功告成
在任意位置Shift+右鍵
via:
https://blog.csdn.net/refbit/article/details/104007239
https://blog.csdn.net/weixin_43870742/article/details/100830921