Einkaufsliste/add-einkauf-hosts.bat
2026-03-27 12:36:18 +01:00

33 lines
768 B
Batchfile

@echo off
setlocal
REM Pruefen, ob Adminrechte vorhanden sind
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Starte mit Administratorrechten neu...
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
set "HOSTS_FILE=%SystemRoot%\System32\drivers\etc\hosts"
findstr /R /C:"^[ ]*127\.0\.0\.1[ ]\+einkauf\.local" "%HOSTS_FILE%" >nul 2>&1
if %errorlevel% neq 0 (
echo 127.0.0.1 einkauf.local>>"%HOSTS_FILE%"
)
findstr /R /C:"^[ ]*::1[ ]\+einkauf\.local" "%HOSTS_FILE%" >nul 2>&1
if %errorlevel% neq 0 (
echo ::1 einkauf.local>>"%HOSTS_FILE%"
)
ipconfig /flushdns
echo.
echo Fertig. Pruefe jetzt:
echo ping einkauf.local
echo Dann im Browser:
echo http://einkauf.local
echo.
pause