Add toggle_if.vbs, net_{ic,dhcp}.bat.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/net/net_dhcp.bat Fri Jan 22 01:01:29 2010 +0900
1.3 @@ -0,0 +1,4 @@
1.4 +@echo off
1.5 +netsh interface ip set address "ローカル エリア接続" dhcp
1.6 +netsh interface ip set dns "ローカル エリア接続" dhcp
1.7 +netsh interface ip set wins "ローカル エリア接続" dhcp
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/net/net_ic.bat Fri Jan 22 01:01:29 2010 +0900
2.3 @@ -0,0 +1,4 @@
2.4 +@echo off
2.5 +netsh interface ip set address "ローカル エリア接続" static 10.240.10.207 255.255.255.0 10.240.10.1 1
2.6 +netsh interface ip set dns "ローカル エリア接続" static 130.34.54.2
2.7 +netsh interface ip add dns "ローカル エリア接続" 130.34.232.25
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/net/toggle_if.vbs Fri Jan 22 01:01:29 2010 +0900
3.3 @@ -0,0 +1,53 @@
3.4 +if WScript.Arguments.Count <> 2 then
3.5 + wscript.quit
3.6 +end if
3.7 +
3.8 +Dim sConnectionName
3.9 +if WScript.Arguments.Item(0) = "lan" then
3.10 + sConnectionName = "ローカル エリア接続"
3.11 +else
3.12 + sConnectionName = "ワイヤレス ネットワーク接続"
3.13 +end if
3.14 +
3.15 +Dim sVerb
3.16 +if WScript.Arguments.Item(1) = "enable" then
3.17 + sVerb = "有効にする(&A)"
3.18 +else
3.19 + sVerb = "無効にする(&B)"
3.20 +end if
3.21 +
3.22 +
3.23 +Const ssfCONTROLS = 3
3.24 +Const sConPaneName = "ネットワーク接続"
3.25 +
3.26 +set shellApp = createobject("shell.application")
3.27 +set oControlPanel = shellApp.Namespace(ssfCONTROLS)
3.28 +set oNetConnections = nothing
3.29 +
3.30 +for each folderitem in oControlPanel.items
3.31 + if folderitem.name = sConPaneName then
3.32 + set oNetConnections = folderitem.getfolder: exit for
3.33 + end if
3.34 +next
3.35 +
3.36 +if oNetConnections is nothing then
3.37 + wscript.quit
3.38 +end if
3.39 +
3.40 +set oLanConnection = nothing
3.41 +for each folderitem in oNetConnections.items
3.42 + if lcase(folderitem.name) = lcase(sConnectionName) then
3.43 + set oLanConnection = folderitem: exit for
3.44 + end if
3.45 +next
3.46 +
3.47 +if oLanConnection is nothing then
3.48 + wscript.quit
3.49 +end if
3.50 +
3.51 +for each verb in oLanConnection.verbs
3.52 + if verb.name = sVerb then
3.53 + verb.Doit
3.54 + WScript.Sleep 2000
3.55 + end if
3.56 +next