要更改 Visual Studio Code (VS Code) 的預設終端機,您需要編輯設定檔案。以下是該步驟的詳細說明:
開啟 VS Code。
點擊左下角的設定圖示(齒輪圖示),選擇「設定」,這將打開「settings.json」設定檔案。
在設定檔案中,您可以尋找或新增以下兩個設定:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
在這兩個設定中,您可以更改 "terminal.integrated.defaultProfile.windows"
的值,將其設為您想要的終端機。例如,如果您想將預設終端機更改為 PowerShell,則將它的值設為 "PowerShell"。
儲存設定檔案。
重新啟動 VS Code,您的預設終端機應該已經更改為您所選擇的終端機。
請確保在編輯設定檔案時保持 JSON 的格式正確,以免出現語法錯誤。完成以上步驟後,您將能夠成功更改 VS Code 的預設終端機。