01.使用记事本创建一个reg后缀的文件,添加下面的内容,
把路径中的username改为自己电脑的用户目录名
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows terminal here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\username\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Windows terminal here(Admin)"
"ShowBasedOnVelocityId"=dword:00639bc8
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="C:\\Users\\username\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
双击执行 reg文件
02.编辑settings.json文件
打开windows terminal,
执行 ctrl+,,或者在标签栏的下拉菜单里面找到设置文件
在对应的命令行配置中添加"startingDirectory": “.”
如下:
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"startingDirectory": "."
},