您好,
欢迎您咨询微软社区论坛。
请尝试同时勾选“适用于 Linux 的 Windows 子系统”以及“虚拟机平台”功能,然后重启电脑。
重启后在管理员模式下打开 PowerShell 或 Windows 命令提示符,输入 wsl --install 命令,然后重启计算机。
完成后查看Linux功能是否成功启用。
希望对您有所帮助。如果后续有任何疑问,请联系我们。
谨致问候
Jacen
锁定的问题。 此问题已从 Microsoft 支持社区迁移。 你可投票决定它是否有用,但不能添加评论或回复,也不能关注问题。 为了保护隐私,对于已迁移的问题,用户个人资料是匿名的。
您好,
欢迎您咨询微软社区论坛。
请尝试同时勾选“适用于 Linux 的 Windows 子系统”以及“虚拟机平台”功能,然后重启电脑。
重启后在管理员模式下打开 PowerShell 或 Windows 命令提示符,输入 wsl --install 命令,然后重启计算机。
完成后查看Linux功能是否成功启用。
希望对您有所帮助。如果后续有任何疑问,请联系我们。
谨致问候
Jacen
您好!
是的,我之前已经注意到了这一点,但是我的核心诉求仍然没有解决。
为了方便使用,我使用如下的批处理手动添加了一个快速访问项
@echo off chcp 936 >nul
set custom_clsid={B2B4A4D1-2754-4140-A2EB-9A76D9D7CDC6}set custom_show_name=WSLset custom_directory=D:\Users\ZhangWeinian\WSL**set custom_icon=C:\Program Files\WSL\wsl.exe,0
*reg query "HKCU\Software\Classes\CLSID%custom_clsid%" >nul 2>&1**if %errorlevel% equ 0 (*reg delete "HKCU\Software\Classes\CLSID%custom_clsid%" /f )
reg add "HKCU\Software\Classes\CLSID%custom_clsid%" /ve /t REG_SZ /d "%custom_show_name%" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%" /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d "0x1" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%" /v "SortOrderIndex" /t REG_DWORD /d "0x42" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\DefaultIcon" /ve /t REG_EXPAND_SZ /d "%custom_icon%" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\InProcServer32" /ve /t REG_EXPAND_SZ /d "%%systemroot%%\system32\shell32.dll" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\Instance" /v "CLSID" /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\Instance\InitPropertyBag" /v "Attributes" /t REG_DWORD /d "0x11" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\Instance\InitPropertyBag" /v "TargetFolderPath" /t REG_EXPAND_SZ /d "%custom_directory%" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\ShellFolder" /v "FolderValueFlags" /t REG_DWORD /d "0x28" /f
reg add "HKCU\Software\Classes\CLSID%custom_clsid%\ShellFolder" /v "Attributes" /t REG_DWORD /d "0xF080004D" /f
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace%custom_clsid%" >nul 2>&1 *if %errorlevel% equ 0 (*reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace%custom_clsid%" /f )
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace%custom_clsid%" /ve /t REG_SZ /d "%custom_show_name%" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "%custom_clsid%" /t REG_DWORD /d "0x1" /f
这与 Windows 自动设置的非常类似,但是一点细节上有所不同。
如果可以,希望告诉我更多信息
----------------------------------------------- 以下内容新建于 2024-12-23 --------------------------------------------
似乎有多人遇到和我一样的情况。为了使用方便,我使用 PowerShell 脚本重新编写了一段代码,功能与上述批处理脚本相同,只是添加了一些提示信息,便于使用者了解执行状态。已经执行过批处理的使用者可以重复执行新的 PowerShell 脚本,但是注意修改代码中的关键项!
$CustomShowName = 'WSL' # 你想要显示的名称,可以自定义 $CustomIcon = 'C:\Program Files\WSL\wsl.exe,0' # 你想要显示的图标,可以自定义 $CustomDirectory = 'D:\Users\ZhangWeinian\WSL' # 你想要显示的目录,可以自定义
$CustomCLSID = '{B2B4A4D1-2754-4140-A2EB-9A76D9D7CDC6}' # 除非你知道此 id 的含义,否则不要修改此项
@( @{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)"'name' = '(default)'; 'type' = 'String'; 'value' = $CustomShowName'info' = '添加 CLSID 并命名扩展名'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)"'name' = 'SortOrderIndex'; 'type' = 'DWord'; 'value' = '0x42''info' = '在导航窗格中设置扩展的位置'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)"'name' = 'System.IsPinnedToNamespaceTree'; 'type' = 'DWord'; 'value' = '0x1''info' = '将扩展添加到导航窗格并使其可见'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\DefaultIcon"'name' = '(default)'; 'type' = 'String'; 'value' = $CustomIcon'info' = '设置扩展的图标'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\InProcServer32"'name' = '(default)'; 'type' = 'String'; 'value' = '%SystemRoot%\system32\shell32.dll''info' = '提供承载扩展的 dll'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\Instance"'name' = 'CLSID'; 'type' = 'String'; 'value' = '{0E5AAE11-A475-4c5b-AB00-C66DE400274E}''info' = '定义实例对象'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\Instance\InitPropertyBag"'name' = 'Attributes'; 'type' = 'DWord'; 'value' = '0x11''info' = '提供目标文件夹的文件系统属性'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\Instance\InitPropertyBag"'name' = 'TargetFolderPath'; 'type' = 'String'; 'value' = $CustomDirectory'info' = '设置同步根的路径'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\ShellFolder"'name' = 'Attributes'; 'type' = 'DWord'; 'value' = '0xf080004d''info' = '设置适当的标志来控制 shell 行为'}@{'path' = "HKCU:\Software\Classes\CLSID$($CustomCLSID)\ShellFolder"'name' = 'FolderValueFlags'; 'type' = 'DWord'; 'value' = '0x228''info' = '设置适当的 shell 标志'}@{'path' = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace$($CustomCLSID)"'name' = '(default)'; 'type' = 'String'; 'value' = $CustomShowName'info' = '显示到左侧导航栏'}@{'path' = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel''name' = $CustomCLSID; 'type' = 'DWord'; 'value' = '0x1''info' = '在桌面隐藏扩展'}) | ForEach-Object { $null = New-ItemProperty -Path $_.path -Name $_.name -PropertyType $_.type -Value $_.value -Force -ErrorAction SilentlyContinue
Write-Host "操作:$($_.info)`n状态:" -NoNewline
if ($?){Write-Host "成功!n" -ForegroundColor Green}else{Write-Host "失败!错误项信息如下:
n" -ForegroundColor RedWrite-Host "目录:$($_.path)n名称:$($\_.name)
n类型:$($_.type)n值:$($\_.value)
n"}}
拷贝上述脚本到一个 ps1 文件中,然后执行(可能需用权限,具体提权/授权方法请自行百度)ps1 脚本,观察输出,如有错误,欢迎回复此帖交流!
你好,我使用家庭版window11,从5/12/2024升级24h2后同样丢失这个选项,这问题是否得到解决?