命令行修改计算机名称

2024-11-21 22:58:40
推荐回答(1个)
回答1:

wmic computersystem where "name='%computername%'" call rename "Someyouwana"

也可以 批处理

@echo off

set /p name=请输您的计算机名:

reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f

reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f

reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f