When the terminal defaults to WSL, Windows right-clicks "Open in Terminal" to correctly start the setting in the current path

Problem recurrence

The Windows Terminal application (terminal) should be the best command-line UI tool on Win at present, and it is very refreshing to use WSL through the terminal. But every time you start the terminal, either the user directory (/mnt/c/User/<username>) is opened by default, or the Linux home directory (/home/<username\). If you want to open a specific path, you need to cd to it yourself.

problem solved

There are already tutorials to teach you how to create a new right-click menu from the registry and open the terminal WSL. Here is how to set up the terminal to correctly open WSL in the current right-click directory.

The WSL version on my computer is Ubuntu. If you have other versions, please replace Ubuntu in the instructions below.

  1. First, the terminal's 设置--page 启动should look like this:
    Startup page settings
  2. Then, 设置the --page of the terminal Ubuntushould be like this, focusing on modifying the command line settings (the default is directly ubuntu.exe, to be modified C:\Windows\system32\wsl.exe -d Ubuntu)
    Ubuntu page settings
  3. Finally, don't forget to click Save to take effect.

Guess you like

Origin blog.csdn.net/liuqixuan1994/article/details/129210617