$ErrorActionPreference = 'Stop' $ProxyHostName = 'hproxy.local' $ProxyPort = 12334 $HttpProxy = "http://${ProxyHostName}:${ProxyPort}" $SocksProxy = "socks5://${ProxyHostName}:${ProxyPort}" $NoProxy = "${ProxyHostName},localhost,127.0.0.1,::1,[::1],.concept-software.ru" $ProxyBypassList = "${ProxyHostName};localhost;127.0.0.1;[::1];*.concept-software.ru" function Set-ProxyEnvironment { $env:HTTP_PROXY = $HttpProxy $env:HTTPS_PROXY = $HttpProxy $env:ALL_PROXY = $SocksProxy $env:NO_PROXY = $NoProxy $env:http_proxy = $HttpProxy $env:https_proxy = $HttpProxy $env:all_proxy = $SocksProxy $env:no_proxy = $NoProxy } function Add-WslEnvEntries { $RequiredEntries = @( 'HTTP_PROXY/u', 'HTTPS_PROXY/u', 'ALL_PROXY/u', 'NO_PROXY/u', 'http_proxy/u', 'https_proxy/u', 'all_proxy/u', 'no_proxy/u' ) $Entries = New-Object System.Collections.Generic.List[string] if (-not [string]::IsNullOrWhiteSpace($env:WSLENV)) { foreach ($Entry in ($env:WSLENV -split ':')) { if (-not [string]::IsNullOrWhiteSpace($Entry) -and -not $Entries.Contains($Entry)) { [void]$Entries.Add($Entry) } } } foreach ($Entry in $RequiredEntries) { if (-not $Entries.Contains($Entry)) { [void]$Entries.Add($Entry) } } $env:WSLENV = [string]::Join(':', $Entries) } function Get-ClaudeExecutable { $Executable = Join-Path $env:LOCALAPPDATA 'AnthropicClaude\claude.exe' if (-not (Test-Path -LiteralPath $Executable)) { throw "Claude Desktop executable was not found: $Executable" } return $Executable } Set-ProxyEnvironment Add-WslEnvEntries $ClaudeExecutable = Get-ClaudeExecutable $ClaudeArguments = @( "--proxy-server=${HttpProxy}", "--proxy-bypass-list=${ProxyBypassList}" ) Start-Process -FilePath $ClaudeExecutable -ArgumentList $ClaudeArguments