简体   繁体   English

当提示从 Visual Studio 2019 IDE 启动时,为什么 wsl(Linux 的 Windows 子系统)在命令提示符中不可用?

[英]Why is wsl (windows subsystem for linux) not available in command prompt when prompt started from the Visual Studio 2019 IDE?

If I start a command prompt from the menu within Visual Studio 2019 then wsl is not availble (and not simply missing a PATH for it):如果我从 Visual Studio 2019 中的菜单启动命令提示符,则 wsl 不可用(而不是简单地缺少它的 PATH):

>wsl
'wsl' is not recognized as an internal or external command,
operable program or batch file.

>dir \windows\system32\wsl.*
 Volume in drive C is Windows
 Volume Serial Number is FE44-8F04

 Directory of c:\windows\system32

File Not Found

If I start a command prompt from start menu (even if I run vcvarsall.bat)如果我从开始菜单启动命令提示符(即使我运行 vcvarsall.bat)

>wsl
My WSL Settings are working
alexp@LT-ALEXP-02:/mnt/c/workspace$

>dir \windows\system32\wsl.*
 Volume in drive C is Windows
 Volume Serial Number is FE44-8F04

 Directory of C:\windows\system32

04/10/2019  04:58           142,848 wsl.exe
               1 File(s)        142,848 bytes
               0 Dir(s)  518,974,992,384 bytes free

This actually applies to a lot of files in the system32 dir (count of files about 2000 different between the 2 environments) but I noticed this trying to use wsl since I use that a lot in windows command prompt to access bash utilities / tools.这实际上适用于 system32 目录中的许多文件(两个环境之间大约有 2000 个不同的文件计数),但我注意到这试图使用 wsl,因为我在 windows 命令提示符中使用了很多来访问 bash 实用程序/工具。

wsl is availble if I start "Developer Command Prompt for VS 2019" from start menu - its only missing if I start this from the "Tools->Visual Studio Command Prompt" menu item within the IDE(and same behaviour in a powershell prompt started from same menu as well)如果我从开始菜单启动“VS 2019 的开发人员命令提示符”,则 wsl 可用 - 如果我从 IDE 中的“工具->Visual Studio 命令提示符”菜单项启动它,则它唯一丢失(并且在 powershell 提示符启动时的相同行为)也来自相同的菜单)

I'm using the professional edition of Visual Studio but a colleague reproduced the same issue and I believe he was using the community edition.我正在使用 Visual Studio 的专业版,但一位同事重现了同样的问题,我相信他使用的是社区版。

Anyone got any ideas what is happening here (and how to fix it)?任何人都知道这里发生了什么(以及如何解决它)?

Should probably have looked some more before asking.问之前可能应该多看一些。

Thanks to https://aigeec.com/using-windows-10-anniversary-bash-with-visual-studio-code/ for providing the clue.感谢https://aigeec.com/using-windows-10-anniversary-bash-with-visual-studio-code/提供线索。

Visual Studio is 32 bit and I'm on a 64 bit OS so system32 is being redirected. Visual Studio 是 32 位的,而我使用的是 64 位操作系统,因此 system32 正在被重定向。

Path in "\windows\sysnative\" and wsl and friends are suddenly availble. "\windows\sysnative\" 和 wsl 和朋友中的路径突然可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Visual Studio 2019 开发人员命令提示符禁用 /Qspectre - how to disable /Qspectre using Visual Studio 2019 Developer Command Prompt 如何列出 WSL(Linux 的 Windows 子系统)中的所有可用用户? - How to list all available users in WSL (Windows subsystem for linux)? 从Visual Studio 2017连接到Windows的Windows子系统 - Connecting to the Windows Subsystem for Linux from Visual Studio 2017 从批处理文件启动的命令提示符在操作停止时关闭 - Command prompt started from batch file closes when operation is stopped 如何从命令提示符下使用Visual Studio 2012编译Windows XP - how can i compile for windows XP with Visual Studio 2012 from the command prompt 从 WSL(Linux 的 Windows 子系统)写入 Windows 磁盘 - Write to windows disk from WSL (Windows subsystem for Linux) 如何从WSL(Linux的Windows子系统)访问aws配置文件? - How to access aws config file from WSL (Windows subsystem for Linux)? 从 Sublime Text 使用 Windows Subsystem for Linux (WSL) - Using Windows Subsystem for Linux (WSL) from Sublime Text 从Visual Studio 2013命令提示符附加到INCLUDE环境变量 - Append to INCLUDE environment variable from Visual Studio 2013 Command Prompt 如何从命令提示符打开 Visual Studio 解决方案文件 - How to open Visual Studio Solution File from the Command Prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM