天天看點

windows terminal 右鍵管理者_添加Windows Terminal到滑鼠右鍵菜單

Windows上有很多指令行程式,例如CMD和PowerShell。微軟在Build 2019上推出了一款面向Windows10的指令行程式,這款程式集合了Windows上的PowerShell、CMD以及Windows Subsystem for Linux于一身,解決了不少惹人吐槽的毛病,甚至被稱為Windows下指令體驗的救世主。而我早在Preview版釋出時,就已經下載下傳使用,現在也是我主要使用的指令行工具。然而畢竟現在還是體驗版的關系,是以并沒有內建在右鍵菜單上。在搜尋了許久之後,終于在Github上找到了安裝方法。

軟體安裝

Windows Terminal 現在還是 Preview 狀态,我們可以在 Microsoft Store 上下載下傳安裝。當然有能力的人,可以下載下傳Github的代碼自己編譯。

Windows Terminal (Preview) - Microsoft Store

GitHub - microsoft/terminal: The new Windows Terminal, and the original Windows console host - all in the same place!

添加 Windows Terminal 到右鍵菜單

測試變量

下面的兩個變量後面的操作需要使用到。是以,先測試下是否正常。

echo %USERPROFILE
echo %LOCALAPPDATA%
           

如果有報錯,接下來的操作,請把對應的部分進行替換。

%USERPROFILE%

替換成

C:Users[userName]

%LOCALAPPDATA%

替換成

C:Users[userName]AppDataLocal

注意

[userName]

為自己的使用者名

windows terminal 右鍵管理者_添加Windows Terminal到滑鼠右鍵菜單

建立圖示

從以下位址下載下傳圖示

圖示ico下載下傳 , 打開網址,滑鼠右鍵儲存到電腦。

打開指令行,輸入

mkdir "%USERPROFILE%AppDataLocalterminal"
           

這個指令是建立一個

terminal

檔案夾,把下載下傳的圖示ico複制到這個檔案夾。

寫入系統資料庫

建立一個txt文檔,并把檔字尾改為

reg

。文檔的名字可自己建立,字尾名不可以錯。右鍵菜單出現

Windows Terminal

有兩種方法。一種是按

shift

+

右鍵

,另一種是直接

右鍵

1. `shift`+ `右鍵`

把下面的内容複制到reg去

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTDirectoryBackgroundshellwt]
@="Windows Terminal"
"Icon"="%USERPROFILE%AppDataLocalterminalwt_32.ico"
"Extended"=""

[HKEY_CLASSES_ROOTDirectoryBackgroundshellwtcommand]
@="C:Users[user_name]AppDataLocalMicrosoftWindowsAppswt.exe"
           
注意

:請把

[user_name]

改成自己電腦的使用者名

右鍵

把下面的内容複制到reg去

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTDirectoryBackgroundshellwt]
@="Windows terminal here"
"Icon"="%USERPROFILE%AppDataLocalterminalwt_32.ico"

[HKEY_CLASSES_ROOTDirectoryBackgroundshellwtcommand]
@="C:Users[user_name]AppDataLocalMicrosoftWindowsAppswt.exe"
           
注意

:請把

[user_name]

改成自己電腦的使用者名

修改`Windows Terminal`的`profile.json`

打開

profile.json

windows terminal 右鍵管理者_添加Windows Terminal到滑鼠右鍵菜單

startingDirectory

改為

null

,沒有的自己建立一個。

windows terminal 右鍵管理者_添加Windows Terminal到滑鼠右鍵菜單

照著上面的方法操作,相信右鍵菜單已經出現

Windows Terminal

的入口了。

windows terminal 右鍵管理者_添加Windows Terminal到滑鼠右鍵菜單

參考

  1. 'Add "open Windows terminal here" into right-click context menu' 下 yanglr 的回答