# HG changeset patch # User Shingo W. Kagami # Date 1264025985 -32400 # Node ID 76409631fed5abb03ee1d59fcb999f547699902f # Parent 5ba7dd492647100948fce62e8085795fdcbfa0ff Add scripts to set network if. diff -r 5ba7dd492647 -r 76409631fed5 lan_dhcp.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lan_dhcp.bat Thu Jan 21 07:19:45 2010 +0900 @@ -0,0 +1,5 @@ +wscript C:\cygwin\home\swk\bin\toggle_if.vbs wireless disable +wscript C:\cygwin\home\swk\bin\toggle_if.vbs lan enable +netsh interface ip set address "ローカル エリア接続" dhcp +netsh interface ip set dns "ローカル エリア接続" dhcp +netsh interface ip set wins "ローカル エリア接続" dhcp diff -r 5ba7dd492647 -r 76409631fed5 lan_ic.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lan_ic.bat Thu Jan 21 07:19:45 2010 +0900 @@ -0,0 +1,5 @@ +wscript C:\cygwin\home\swk\bin\toggle_if.vbs wireless disable +wscript C:\cygwin\home\swk\bin\toggle_if.vbs lan enable +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 5ba7dd492647 -r 76409631fed5 toggle_if.vbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toggle_if.vbs Thu Jan 21 07:19:45 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 diff -r 5ba7dd492647 -r 76409631fed5 wireless_dhcp.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wireless_dhcp.bat Thu Jan 21 07:19:45 2010 +0900 @@ -0,0 +1,5 @@ +wscript C:\cygwin\home\swk\bin\toggle_if.vbs lan disable +wscript C:\cygwin\home\swk\bin\toggle_if.vbs wireless enable +netsh interface ip set address "ワイヤレス ネットワーク接続" dhcp +netsh interface ip set dns "ワイヤレス ネットワーク接続" dhcp +netsh interface ip set wins "ワイヤレス ネットワーク接続" dhcp diff -r 5ba7dd492647 -r 76409631fed5 wireless_ic.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wireless_ic.bat Thu Jan 21 07:19:45 2010 +0900 @@ -0,0 +1,5 @@ +wscript C:\cygwin\home\swk\bin\toggle_if.vbs lan disable +wscript C:\cygwin\home\swk\bin\toggle_if.vbs wireless enable +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