[英]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.