# HG changeset patch # User Shingo W. Kagami # Date 1264089689 -32400 # Node ID 577963cc46fcd92adc2598bc60bd3c94ec536e2b # Parent 3b65651e7033b77c169f406f09df663c2c13fbe0 Add toggle_if.vbs, net_{ic,dhcp}.bat. diff -r 3b65651e7033 -r 577963cc46fc net/net_dhcp.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/net/net_dhcp.bat Fri Jan 22 01:01:29 2010 +0900 @@ -0,0 +1,4 @@ +@echo off +netsh interface ip set address "ローカル エリア接続" dhcp +netsh interface ip set dns "ローカル エリア接続" dhcp +netsh interface ip set wins "ローカル エリア接続" dhcp diff -r 3b65651e7033 -r 577963cc46fc net/net_ic.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/net/net_ic.bat Fri Jan 22 01:01:29 2010 +0900 @@ -0,0 +1,4 @@ +@echo off +netsh interface ip set address "ローカル エリア接続" static 10.240.10.207 255.255.255.0 10.240.10.1 1 +netsh interface ip set dns "ローカル エリア接続" static 130.34.54.2 +netsh interface ip add dns "ローカル エリア接続" 130.34.232.25 diff -r 3b65651e7033 -r 577963cc46fc net/toggle_if.vbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/net/toggle_if.vbs Fri Jan 22 01:01:29 2010 +0900 @@ -0,0 +1,53 @@ +if WScript.Arguments.Count <> 2 then + wscript.quit +end if + +Dim sConnectionName +if WScript.Arguments.Item(0) = "lan" then + sConnectionName = "ローカル エリア接続" +else + sConnectionName = "ワイヤレス ネットワーク接続" +end if + +Dim sVerb +if WScript.Arguments.Item(1) = "enable" then + sVerb = "有効にする(&A)" +else + sVerb = "無効にする(&B)" +end if + + +Const ssfCONTROLS = 3 +Const sConPaneName = "ネットワーク接続" + +set shellApp = createobject("shell.application") +set oControlPanel = shellApp.Namespace(ssfCONTROLS) +set oNetConnections = nothing + +for each folderitem in oControlPanel.items + if folderitem.name = sConPaneName then + set oNetConnections = folderitem.getfolder: exit for + end if +next + +if oNetConnections is nothing then + wscript.quit +end if + +set oLanConnection = nothing +for each folderitem in oNetConnections.items + if lcase(folderitem.name) = lcase(sConnectionName) then + set oLanConnection = folderitem: exit for + end if +next + +if oLanConnection is nothing then + wscript.quit +end if + +for each verb in oLanConnection.verbs + if verb.name = sVerb then + verb.Doit + WScript.Sleep 2000 + end if +next