@:rec
@set hostname=
@set ansure=
@cls
@set /p hostname=计算机名:
@if not defined hostname goto :rec
@cls
@echo.
@echo.
@echo.计算机名 - %hostname%
@echo.
@echo.
@set /p ansure=(输入Y确定 否则自动重输):
@if not defined ansure goto :rec
@if %ansure% == y goto :rename
@if %ansure% == Y goto :rename
goto :rec
:rename
@echo [Version]>d:\bak\regis.inf
@echo Signature="$Windows NT$">>%systemroot%\regis.inf
@echo [DefaultInstall] >>%systemroot%\regis.inf
@echo AddReg=add >>%systemroot%\regis.inf
@echo [add] >>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName",ComputerName,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName",ComputerName,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters",Hostname,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NV Hostname",,%hostname%>>%systemroot%\regis.inf
@rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 %systemroot%\regis.inf
@rem 打开记事本(开始-运行:notepad)把以上内容另存为*.bat文件或*.cmd文件,双击运行后则可
@set hostname=
@set ansure=
@cls
@set /p hostname=计算机名:
@if not defined hostname goto :rec
@cls
@echo.
@echo.
@echo.计算机名 - %hostname%
@echo.
@echo.
@set /p ansure=(输入Y确定 否则自动重输):
@if not defined ansure goto :rec
@if %ansure% == y goto :rename
@if %ansure% == Y goto :rename
goto :rec
:rename
@echo [Version]>d:\bak\regis.inf
@echo Signature="$Windows NT$">>%systemroot%\regis.inf
@echo [DefaultInstall] >>%systemroot%\regis.inf
@echo AddReg=add >>%systemroot%\regis.inf
@echo [add] >>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName",ComputerName,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName",ComputerName,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters",Hostname,,%hostname%>>%systemroot%\regis.inf
@echo HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NV Hostname",,%hostname%>>%systemroot%\regis.inf
@rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 %systemroot%\regis.inf
@rem 打开记事本(开始-运行:notepad)把以上内容另存为*.bat文件或*.cmd文件,双击运行后则可