如何用 AU3 改计算机名?
例如,把 wind 改为 pc123
[ 本帖最后由 陌上风 于 2008-6-17 17:52 编辑 ] 改注册表的.
然后刷新一下. 注册表或wmi都可以 Func _SetComputerName($Hostname, $Hostname1);设置计算机名和描述
$SetKey1 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\"
$CtrlKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\"
$Return = RegWrite($SetKey1 & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $Hostname)
RegWrite($SetKey1 & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $Hostname)
RegWrite($SetKey1 & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $Hostname)
RegWrite($CtrlKey & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $Hostname)
RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters', "srvcomment", "REG_SZ", $Hostname1)
$str1 = StringRegExp($Hostname, ".*(.{3})", 1)
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters", "VirtualNetworkNumber", "REG_DWORD", "0x" & $str1)
Return $Return
EndFunc ;==>_SetComputerName 好像这个简单点
http://www.autoitx.com/forum.php?mod=viewthread&tid=14&highlight=%BC%C6%CB%E3%BB%FA%C3%FB 学习一下。。。 要是有办法不重启就能成功改电脑名称并生效就完美了! 域环境不可能 本帖最后由 ferelove 于 2012-1-26 22:37 编辑
要是有办法不重启就能成功改电脑名称并生效就完美了!
抄用一段DOS命令,转成AU3应该不难。不重启电脑生效。set "PCName=AU3TEST"
rem 更改机器名
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /d "%PCName%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /d "%PCName%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v "ComputerName" /d "%PCName%" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /d "%PCName%" /f
taskkill /f /im explorer.exe & explorer.exe
页:
[1]