2023-05-02 2023-05-02 任务管理器关闭wslservice.exe,wslg.exe等 然后管理员打开powershell运行以下代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #Requires -RunAsAdministrator # Fix for https://github.com/microsoft/WSL/issues/4177 $MethodDefinition = @' [DllImport("ws2_32.dll", CharSet = CharSet.Unicode)] public static extern int WSCSetApplicationCategory([MarshalAs(UnmanagedType.LPWStr)] string Path, uint PathLength, [MarshalAs(UnmanagedType.LPWStr)] string Extra, uint ExtraLength, uint PermittedLspCategories, out uint pPrevPermLspCat, out int lpErrno); '@ $Ws2Spi = Add-Type -MemberDefinition $MethodDefinition -Name 'Ws2Spi' -PassThru $WslLocation = Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux | Select-Object -expand InstallLocation $Executables = ("wsl.exe", "wslservice.exe","wslg.exe","wslhost.exe"); foreach ($Exe in $Executables) { $ExePath = "${WslLocation}\${Exe}"; $ExePathLength = $ExePath.Length; $PrevCat = $null; $ErrNo = $null; if ($Ws2Spi::WSCSetApplicationCategory($ExePath, $ExePathLength, $null, 0, [uint32]"0x80000000", [ref] $PrevCat, [ref] $ErrNo) -eq 0) { Write-Output "Added $ExePath!"; } } 把以上脚本设置为开机启动,这样windows store更新wsl的时候也能同步更新。 参考:https://github.com/microsoft/WSL/issues/4177#issuecomment-1359200646 前一篇 Word合并表格回车删除不掉的解决方法 后一篇 如何导出windows平台下cloudflare warp内部存的私钥和token
说些什么吧!