ken_nogi/PAD/Run-Normalize-Hostname-UnderscoreToHyphen-Admin.bat
Kenichiro NOGI 88a402ce0f up
2026-07-10 18:13:30 +09:00

30 lines
782 B
Batchfile

@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
set "PS1=%SCRIPT_DIR%Normalize-Hostname-UnderscoreToHyphen.ps1"
if not exist "%PS1%" (
echo [ERROR] PowerShell script not found: "%PS1%"
exit /b 1
)
net session >nul 2>&1
if not "%ERRORLEVEL%"=="0" (
echo Requesting administrator permission...
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
echo Running: powershell -NoProfile -ExecutionPolicy Bypass -File Normalize-Hostname-UnderscoreToHyphen.ps1 -Restart
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS1%" -Restart
set "RC=%ERRORLEVEL%"
if not "%RC%"=="0" (
echo [ERROR] Script finished with exit code %RC%
exit /b %RC%
)
echo [OK] Hostname normalization script finished successfully.
exit /b 0