|
4#
楼主 |
发表于 2006-9-8 17:33:33
|
只看该作者
原帖由 tmt2008 于 2006-9-8 02:53 PM 发表
难哪!
要修改许多键值和TCPIP有关的数据。
乱讲。。。我给你VBS给你看啊。
- dim WshShell,oc,c
- Set WshShell = CreateObject("Wscript.Shell")
- oc=ucase(WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"))
- if oc="XP51" then
- c=oc & "-" & replace(cstr(timer),".","")
- else
- c=oc
- end if
- c=ucase(InputBox( vbcr & " 当前计算机名:"& oc & vbcr & vbcr &vbcr &vbcr &" 请输入新计算机名:","更改计算机名",c ))
- if trim(""&c)="" then Wscript.quit
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName", c ,"REG_SZ"
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV Hostname", c ,"REG_SZ"
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname", c ,"REG_SZ"
- msgbox(" 修改成功! 重启生效。")
复制代码
还要不要全自动的?呵呵
- dim WshShell,c
- Set WshShell = CreateObject("Wscript.Shell")
- c="XP51" & "-" & replace(cstr(timer),".","")
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName", c ,"REG_SZ"
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV Hostname", c ,"REG_SZ"
- WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname", c ,"REG_SZ"
复制代码 |
|