党校心得体会,夫妻相测试,武夷山市人民政府
vbs脚本的功能非常强大, 管理系统简单方便!下面的脚本win2000和winxp都可以使用,win2003没有测试过, 应该也没有问题。如果需要经常切换网关,或是ip,这个脚本是最方便的了。稍微修改一下甚至可以做到1分钟变一次ip。
:start
cls
color 2f
:: 使用color命令对控制台输出颜色进行更改
mode con cols=56 lines=20
:: mode语句为设定窗体的宽和高
:sc_main
echo -------------------------------------------
echo.&echo.
echo 0.192.168.0.99 & echo.
echo 1.192.168.1.99 & echo.
echo q.退出 & echo.&echo.&echo.&echo.&echo.&echo.
set "select="
set/p select= 输入数字,按回车继续 :
if "%select%"=="0" (goto sc_ip0)
if "%select%"=="1" (goto sc_ip1)
if "%select%"=="q" (goto sc_exit)
:sc_exit
exit
goto :eof
:sc_ip0
cls
echo 正在设置中,请稍候
netsh interface ip set address "本地连接" static 192.168.0.99 255.255.255.0 192.168.0.1 1
netsh interface ip set dns "本地连接" static 192.168.0.1 primary
echo 设置成功 192.168.0.99
pause >nul
goto sc_main
:sc_ip1
cls
echo 正在设置中,请稍候
netsh interface ip set address "本地连接" static 192.168.1.99 255.255.255.0 192.168.1.1 1
netsh interface ip set dns "本地连接" static 192.168.1.1 primary
echo 设置成功 192.168.1.99
pause >nul
goto sc_main
vbs修改ip
for each objnetadapter in colnetadapters
sip=objnetadapter.ipaddress
stripaddress = sip '保持原来的ip,如果需要修改ip为192.168.0.200:stripaddress = array("192.168.0.200")
strsubnetmask = array("255.255.255.0")
strgateway = array("192.168.0.254") '修改网关为192.168.0.254
strgatewaymetric = array(1)
errenable = objnetadapter.enablestatic(stripaddress, strsubnetmask)
errgateways = objnetadapter.setgateways(strgateway, strgatewaymetric)
if errenable = 0 then
wscript.echo "the ip address has been changed."
else
wscript.echo "the ip address could not be changed."
end if
exit for '只修改第一个网卡的设置
next
vbs修改ip
dim i
i=inputbox("输入机器序号(2-254)")
if i="" then
msgbox "error: 序号不正确!"
else
dim shell
set shell = createobject("wscript.shell")
'修改计算机名
shell.regwrite "hklm\system\currentcontrolset\control\computername\computername\computername", head & transh(i) ,"reg_sz"
shell.regwrite "hklm\system\currentcontrolset\services\tcpip\parameters\nv hostname", head & transh(i) ,"reg_sz"
shell.regwrite "hklm\system\currentcontrolset\services\tcpip\parameters\hostname", head & transh(i) ,"reg_sz"
'修改ip
shell.run "netsh interface ip set address 本地连接 static " & iphead & "." & i & " 255.255.255.0 " & ipgate & ".252 1"
'msgbox "ok"
shell.run "netsh interface ip set address 本地连接 static " & iphead & "." & i & " 255.255.255.0 " & ipgate & ".252 1"
'msgbox "ok"
shell.run "netsh interface ip set address 本地连接 static " & iphead & "." & i & " 255.255.255.0 " & ipgate & ".252 1"
'msgbox "ok"
end if
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
网友评论