-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-google-cloudcode.bat
More file actions
88 lines (77 loc) · 2.5 KB
/
Copy pathfix-google-cloudcode.bat
File metadata and controls
88 lines (77 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
setlocal
title Google Cloud Code Hosts Fix
color 0B
echo.
echo ================================================================
echo ^| ^|
echo ^| GOOGLE CLOUD CODE / ANTIGRAVITY HOSTS FIX ^|
echo ^| ^|
echo ================================================================
echo.
echo Target : cloudcode-pa.googleapis.com
echo Action : remove broken hosts entry + flush DNS
echo.
:: Check Administrator permission
net session >nul 2>&1
if %errorlevel% neq 0 (
color 0E
echo [!] Administrator permission is required.
echo [*] Requesting Administrator access...
echo.
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
set "HOSTS_FILE=C:\Windows\System32\drivers\etc\hosts"
set "TARGET_DOMAIN=cloudcode-pa.googleapis.com"
echo [1/3] Cleaning hosts file...
echo Removing entries containing: %TARGET_DOMAIN%
echo.
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$hosts='%HOSTS_FILE%';" ^
"$domain='%TARGET_DOMAIN%';" ^
"$content=Get-Content -Path $hosts -ErrorAction Stop;" ^
"$filtered=$content | Where-Object { $_ -notmatch [regex]::Escape($domain) };" ^
"Set-Content -Path $hosts -Value $filtered -Encoding ASCII;" ^
"Write-Host ' Done.'"
if %errorlevel% neq 0 (
color 0C
echo.
echo [ERROR] Failed to update hosts file.
echo Please run this script as Administrator.
echo.
pause
exit /b 1
)
echo.
echo [2/3] Flushing DNS cache...
ipconfig /flushdns
echo.
echo [3/3] Verifying result...
findstr /i "%TARGET_DOMAIN%" "%HOSTS_FILE%" >nul 2>&1
if %errorlevel% equ 0 (
color 0C
echo.
echo ================================================================
echo FIX FAILED
echo ================================================================
echo.
echo The hosts file still contains: %TARGET_DOMAIN%
echo.
echo Please open this file manually and remove that line:
echo %HOSTS_FILE%
) else (
color 0A
echo.
echo ================================================================
echo FIX COMPLETED SUCCESSFULLY
echo ================================================================
echo.
echo Hosts file is clean.
echo Google Cloud Code / Antigravity sign-in should work normally
echo if the hosts entry was the cause.
)
echo.
echo Press any key to exit...
pause >nul
endlocal