复制内容到剪贴板
代码:
if Wscript.arguments.count<3 then
wscript.echo " ProGram:xiaohua QQ:56111981"
wscript.echo " Please Input like:"&vbcrlf&" cscript setip.vbs ipaddress subnetmask gateway"
wscript.echo " cscript setip.vbs 192.168.0.39 255.255.255.0 192.168.0.1"
wscript.quit
end if
setIp=Wscript.Arguments(0)
SubnetMask=Wscript.Arguments(1)
GateWay=Wscript.Arguments(2)
'机器名,.代表本机
strComputer="."
Set objWMIService = GetObject("winmgmts:\\"&strComputer&"\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress=Array(setIp)
strSubnetMask=Array(SubnetMask)
strGateway=Array(GateWay)
strGatewayMetric=Array(1)
For Each objNetAdapter in colNetAdapters
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
Nextcscript下用参数启动……
; h% J. s( p$ t! j* D
! {2 n! p: `3 r) S不过这是针对本机的,如果用AD推的话不一定有效果……
; \2 h) i* \6 y0 h1 p7 l. A- u# R' k
0 \6 ^" E I4 P# T$ i4 o; j
[
本帖最后由 ghjconan 于 2007-5-5 19:44 编辑 ]