📜  使用命令启动 wsl - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:16.610000             🧑  作者: Mango

代码示例2
Create a dedicated profile:
The commandline option also accepts arguments, which are directly passed to the shell on startup, allowing the direct usage of wsl.exe with an additional "startup command":
{
  "guid": "{...}",
  "hidden": false,
  "name": "Ubuntu SSH",
  "commandline": "wsl.exe ssh -L 3306:localhost:3306 -L 5900:localhost:5900 -L 8001:localhost:8001 user@target.com",
}
I can now start the shell via a batch file, which runs using the below; however, the downside is the new profile is shown in Windows Terminal's Profile Selection Menu:
wt -p "Ubuntu SSH"