Bas*_*mme 13 windows windows-subsystem-for-linux
从他的开发机上的商店中安装Linux和Ubuntu的Subsystem时,我可以简单地切换(或启动)到Ubuntu shell
但是,Ubuntu Shell /home/techsupp默认情况下从文件夹启动。是否可以强制它与我使用的Ubuntu命令在同一文件夹中启动?
所以在我的例子中,我应该在
/mnt/h
Run Code Online (Sandbox Code Playgroud)
谢谢。
我已经尝试过的
H:\>ubuntu help
Launches or configures a linux distribution.
Usage:
<no args>
- Launches the distro's default behavior. By default, this launches your default shell.
run <command line>
- Run the given command line in that distro, using the default configuration.
- Everything after `run ` is passed to the linux LaunchProcess call.
config [setting [value]]
- Configure certain settings for this distro.
- Settings are any of the following (by default)
- `--default-user <username>`: Set the default user for this distro to <username>
clean
- Uninstalls the distro. The appx remains on your machine. This can be
useful for "factory resetting" your instance. This removes the linux
filesystem from the disk, but not the app from your PC, so you don't
need to redownload the entire tar.gz again.
help
- Print this usage message.
Run Code Online (Sandbox Code Playgroud)
我还在uservoice上发现了此请求:https ://wpdev.uservoice.com/forums/266908-command-prompt-console-windows-subsystem-for-l/suggestions/13421103-let-us-right-click-open- bash从这里浏览器?tracking_code = 8a8bc624c72a8336565fcd6d5737d712
请投票。
Emm*_*rra 57
我在带有 May Update 的 Windows 10 Home 上安装了用于 WSL 的 Ubunto 18.04,我可以使用Shift + 右键单击并选择在此处打开 Linux shell选项在任何文件夹中打开控制台
tal*_*les 25
如果您在任务管理器中检查资源管理器“在此处打开 Linux shell”选项如何打开 wsl,您可以看到有一个“--cd”选项。

X. *_*Liu 13
如果使用wsl.exe,它将在当前目录中启动 WSL。但之间的区别wsl,并ubuntu是,如果你已经安装了两个或两个以上的发行版(E,G,Ubuntu和Fedora的),默认的将上手。您可以通过运行将默认设置为 Ubuntu wslconfig /setdefault Ubuntu。
参考:[1] https://docs.microsoft.com/en-us/windows/wsl/wsl-config
ubuntu run
Run Code Online (Sandbox Code Playgroud)
运行<command line>
在当前工作目录中运行提供的命令行。如果未
提供命令行,则将启动默认外壳程序。
据我所知,效果与运行相同ubuntu,除了它从当前目录开始。
即使在资源管理器中右键单击“在此处打开”命令,此命令也可以工作。根据本文改编:
HKEY_CLASSES_ROOT\Directory\Background\shell并创建一个新密钥(Default)为“在此处打开Ubuntu”或类似内容。command(Default)为ubuntu run现在,您可以在资源管理器中右键单击菜单“在此处打开Ubuntu”。
我wsl遇到的问题是,即使wsl bash窗口启动了Ubuntu发行版,它也没有Ubuntu图标。
第 1 步:安装Windows 终端
步骤 2:转到要在其中打开 Ubuntu 的文件夹,然后右键单击打开 Windows 终端。
步骤 3:转到 Windows 终端设置并导航到您的 Linux 发行版(在我的例子中为 Ubuntu 20.04)并选中此选项。
现在,每次您通过 Windows 终端打开 Ubuntu 时,它都会在该目录中打开。
对我有用的方法是使用 Windows 终端应用程序并将其配置为在所需位置启动。
基于 WSL2 和 Ubuntu 20.04 的示例:
settings.json - 将此行添加到“Ubuntu-20.04”部分:
"startingDirectory": "//wsl$/Ubuntu-20.04/home/<username>/"
Run Code Online (Sandbox Code Playgroud)
将 <username> 更改为您在安装 Ubuntu 20.04 时创建的用户名。
| 归档时间: |
|
| 查看次数: |
7150 次 |
| 最近记录: |