用cmd改计算机名.bat 无需重启电脑生效

echo off
set /p cname=请输入计算机名:

echo REGEDIT4 >reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName] >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName] >> reg.reg
echo "ComputerName"="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName] >> reg.reg
echo "ComputerName"="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\ComputerName\ComputerName] >> reg.reg
echo "ComputerName"="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >> reg.reg
echo "NV Hostname"="%cname%" >> reg.reg
echo "Hostname"="%cname%" >> reg.reg

echo [HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\ShellNoRoam] >> reg.reg
echo @="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName] >> reg.reg
echo "ComputerName"="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters] >> reg.reg
echo "NV Hostname"="%cname%" >> reg.reg
echo "Hostname"="%cname%" >> reg.reg

echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] >> reg.reg
echo "DefaultDomainName"="%cname%" >> reg.reg
echo "AltDefaultDomainName"="%cname%" >> reg.reg

regedit /s reg.reg

上一篇:自己动手 IBeacon 室内定位 完整体验(超详细过程)


下一篇:AngularJS开发指南6:AngularJS表单详解