equal
deleted
inserted
replaced
|
1 if WScript.Arguments.Count <> 2 then |
|
2 wscript.quit |
|
3 end if |
|
4 |
|
5 Dim sConnectionName |
|
6 if WScript.Arguments.Item(0) = "lan" then |
|
7 sConnectionName = "ローカル エリア接続" |
|
8 else |
|
9 sConnectionName = "ワイヤレス ネットワーク接続" |
|
10 end if |
|
11 |
|
12 Dim sVerb |
|
13 if WScript.Arguments.Item(1) = "enable" then |
|
14 sVerb = "有効にする(&A)" |
|
15 else |
|
16 sVerb = "無効にする(&B)" |
|
17 end if |
|
18 |
|
19 |
|
20 Const ssfCONTROLS = 3 |
|
21 Const sConPaneName = "ネットワーク接続" |
|
22 |
|
23 set shellApp = createobject("shell.application") |
|
24 set oControlPanel = shellApp.Namespace(ssfCONTROLS) |
|
25 set oNetConnections = nothing |
|
26 |
|
27 for each folderitem in oControlPanel.items |
|
28 if folderitem.name = sConPaneName then |
|
29 set oNetConnections = folderitem.getfolder: exit for |
|
30 end if |
|
31 next |
|
32 |
|
33 if oNetConnections is nothing then |
|
34 wscript.quit |
|
35 end if |
|
36 |
|
37 set oLanConnection = nothing |
|
38 for each folderitem in oNetConnections.items |
|
39 if lcase(folderitem.name) = lcase(sConnectionName) then |
|
40 set oLanConnection = folderitem: exit for |
|
41 end if |
|
42 next |
|
43 |
|
44 if oLanConnection is nothing then |
|
45 wscript.quit |
|
46 end if |
|
47 |
|
48 for each verb in oLanConnection.verbs |
|
49 if verb.name = sVerb then |
|
50 verb.Doit |
|
51 WScript.Sleep 2000 |
|
52 end if |
|
53 next |