Situatie
Schimbarea hostname-ului folosind un batch file
Atentie : Acesta trebuie rulat cu drepturi de administrator, altfel nu va functiona !
Pasul 1 : Copiem codul de mai jos intr-un editor de text:
@ECHO OFF
mode con:cols=59 lines=10
echo.
echo Your computer name is [ “%computername%” ]
echo Do you want to change it?
echo.
choice /C YN /N /M “Yes/No->”
goto option-%errorlevel%
:option-1
echo.
set /p input=New name for your computer :
wmic computersystem where name=”%COMPUTERNAME%” call Rename Name=”%input%”
cls
echo.
echo New computer name : “%input%”
set /p RESTART= WOULD YOU LIKE TO RESTART YOUR COMPUTER NOW?(Y/N):
echo.
If /I “%RESTART%”==”Y” (
shutdown.exe /r /t 1
goto shutdown
) else (
echo YOU CHOSE NOT TO RESTART YOUR COMPUTER.
echo.
echo REMEMBER THAT YOU STILL NEED TO RESTART YOUR COMPUTER
echo SO THE CHANGES CAN BE APPLIED!
)
pause
:option-2
pause
Pasul 2 : Salvam fisierul cu orice nume + extensia .bat sau .cmd. EX: shutdown.bat
ATENTIE : Acesta trebuie rulat cu drepturi de administrator! Dupa restart, noul hostname va fi vizibil.
Leave A Comment?