Welcome to Elvin's blog

cmd 更改计算机名

bat  更改计算机名

不用重启电脑就生效^_^ 

 

@Echo off
Color 0A
title ……更改计算机名
:A
cls
echo.
echo.    [0]退出 
echo.
echo.    不用重启电脑就生效^_^ 
echo.
echo.    必须以管理员身份运行 !
echo.
echo.
set /p pc=       [输入计算机名] # 
If "%pc%"=="" goto A
If "%pc%"=="0" exit
set computername=%pc%
:: PC name
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d "%computername%" /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d "%computername%" /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d "%computername%" /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d "%computername%" /f

set/p=  ■<nul
for /L %%i in (1,1,38) do set /p a=■<nul&ping /n 1 127.0.0.1>nul
echo   100%%
:end
exit

 

posted @ 2017-11-02 22:25  blog-elvin-vip  阅读(4422)  评论(0编辑  收藏  举报