使用腳本自動(dòng)修改ip設(shè)置
@Echo Off
TITLE 腳本之家ip設(shè)置器
:start
CLS
COLOR 2f
:: 使用COLOR命令對(duì)控制臺(tái)輸出顏色進(jìn)行更改
mode con cols=56 lines=20
:: MODE語(yǔ)句為設(shè)定窗體的寬和高
: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= 輸入數(shù)字,按回車?yán)^續(xù) :
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 正在設(shè)置中,請(qǐng)稍候
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 設(shè)置成功 192.168.0.99
PAUSE >nul
Goto sc_main
:sc_ip1
cls
echo 正在設(shè)置中,請(qǐng)稍候
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 設(shè)置成功 192.168.1.99
PAUSE >nul
Goto sc_main
vbs修改ip
changeip.vbsstrComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter in colNetAdapters
sip=objNetAdapter.IPAddress
strIPAddress = sip '保持原來(lái)的ip,如果需要修改ip為192.168.0.200:strIPAddress = Array("192.168.0.200")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.0.254") '修改網(wǎng)關(guān)為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 '只修改第一個(gè)網(wǎng)卡的設(shè)置
Next
VBS修改IP
'VBS修改IP
function transh(s)
if isnumeric(s) then
if len(s)=1 then
transh="00" & s
elseif len(s)=2 then
transh="0" & s
elseif len(s)=3 then
transh=s
end if
else
transh=""
end if
end function
dim head
'機(jī)器名頭
head="B"
'ip頭
iphead="192.168.131"
ipgate="192.168.131"
dim i
i=inputbox("輸入機(jī)器序號(hào)(2-254)")
if i="" then
msgbox "Error: 序號(hào)不正確!"
else
dim shell
set shell = CreateObject("WScript.Shell")
'修改計(jì)算機(jī)名
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
相關(guān)文章
vbs 獲取當(dāng)前目錄的實(shí)現(xiàn)代碼
獲取當(dāng)前正執(zhí)行的VBS的路徑,通過(guò)Scripting.FileSystemObject組件實(shí)現(xiàn)2013-09-09將HTML或txt文件轉(zhuǎn)換為ASP輸出的vbs代碼
因?yàn)樾枰胊sp輸出一段內(nèi)容,如果內(nèi)容過(guò)多的話,不斷的response.write太累,所以就需要用這斷代碼,方便用快速的轉(zhuǎn)換,其實(shí)只要是文本文件都可以輸出的。2011-01-01VBS 十六進(jìn)制異或加密實(shí)現(xiàn)代碼
文件不要過(guò)大,最好不要超過(guò) 100 KB,密鑰不要用數(shù)字,不想改了。理論上支持任何二進(jìn)制文件格式2013-07-07使用 Iisext.vbs 刪除應(yīng)用程序依存關(guān)系的實(shí)現(xiàn)方法
這篇文章主要介紹了使用 Iisext.vbs 刪除應(yīng)用程序依存關(guān)系的實(shí)現(xiàn)方法,需要的朋友可以參考下2014-07-07vbs 查找硬盤分區(qū)中指定擴(kuò)展名文件的實(shí)現(xiàn)代碼
vbs 用于查找硬盤所有分區(qū)中指定擴(kuò)展名文件的代碼,有需要的朋友可以參考下。挺實(shí)用的一段代碼,用來(lái)深入學(xué)習(xí)vbs,確實(shí)不錯(cuò)2014-05-05