@echo off echo ============================================== echo Change Computer Name echo ============================================== :: Get and display the current computer name for /f "tokens=*" %%i in ('hostname') do set CurrentName=%%i echo Current Computer Name: %CurrentName% :: Prompt the user to enter the new computer name set /p NewName=Enter the new computer name: :: Confirm the entered name echo ============================================== echo Current Computer Name: %CurrentName% echo New Computer Name: %NewName% echo ============================================== pause :: Change the computer name using WMIC wmic computersystem where name="%CurrentName%" call rename name="%NewName%" :: Restart the computer echo Computer name changed successfully. Restarting... shutdown /r /t 0