We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@echo off setlocal :: 设置 PowerShell 脚本编码为 UTF-8 set "PSModulePath=%PSModulePath%;%SystemRoot%\System32\WindowsPowerShell\v1.0\Modules" :: 下载 hosts 文件并指定编码为 UTF-8 powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; $webClient = New-Object System.Net.WebClient; $webClient.Encoding = [System.Text.Encoding]::UTF8; $webClient.DownloadFile('https://raw.hellogithub.com/hosts', '%temp%\hosts.txt')" :: 检查是否下载成功 if not exist "%temp%\hosts.txt" ( echo 下载 hosts 文件失败。 pause exit /b 1 ) :: 使用 PowerShell 将内容追加到 C:\Windows\System32\drivers\etc\hosts 并指定编码为 UTF-8 powershell -Command "$hostsContent = Get-Content -Path '%temp%\hosts.txt' -Encoding UTF8; Add-Content -Path 'C:\Windows\System32\drivers\etc\hosts' -Value $hostsContent -Encoding UTF8" :: 刷新 DNS 缓存 ipconfig /flushdns :: 删除临时文件 del "%temp%\hosts.txt" :: 等待3秒后关闭命令行窗口 timeout /t 3 /nobreak >nul endlocal
https://raw.hellogithub.com/hosts
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://raw.hellogithub.com/hosts
The text was updated successfully, but these errors were encountered: