ちょっと感化されて、弄っただけだけどWSP書いてみたYO! << ここからコピー >> Dim Count,Args,Prm Count = WScript.Arguments.Count If Count < 1 Then MsgBox WScript.ScriptName + " [ shutdown | reboot | logoff ] ",vbOkOnly & vbInformation,"使用方法" WScript.Quit End If
Args = WScript.Arguments.Item(0) If Args = "shutdown" Then Prm = "8" ElseIf Args = "reboot" Then Prm = "2" ElseIf Args = "logoff" Then Prm = "0" Else MsgBox "引数が間違っています ",vbOkOnly & vbExclamation,"不明な引数" WScript.Quit End If
Set objSystemSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem") For Each objSystem In objSystemSet objSystem.Win32Shutdown Prm Next WScript.Quit << ここまでコピー >>
Dim objWS,objIE, sURL, mode,before,after, i Set objWS = CreateObject("WScript.Shell") sURL = "http://www.excite.co.jp/world/text/?wb_lp=%m&before=%b" If WScript.Arguments.Count >= 2 Then mode = UCase(Wscript.Arguments(0)) If Left(mode,1)="/" Then mode = Mid(mode,2,4) For i = 1 To WScript.Arguments.Count-1 before = Trim(before & " " & Wscript.Arguments(i)) Next End If If (mode = "JAEN" Or mode = "ENJA") And before <> "" Then Set objIE = WScript.CreateObject("InternetExplorer.Application","IE_") With objIE .Navigate2 Replace(Replace(sURL,"%m",mode),"%b",enc(before)) .Visible = False While .Busy Or .ReadyState<>4 WScript.Sleep 200 Wend after = .Document.World.after.Value .Quit End With Set objIE = Nothing objWS.Popup before & vbCrLf & vbCrLf & after,30,WScript.ScriptName Else objWS.Popup "Error in Commandline.",15,WScript.ScriptName End If WScript.Quit 0 Function enc(s) Dim d d = Replace(s,"%","%25") d = Replace(d," ","%20") d = Replace(d,"#","%23") d = Replace(d,"&","%26") d = Replace(d,"+","%2B") d = Replace(d,";","%3B") d = Replace(d,"=","%3D") d = Replace(d,"?","%3F") enc = d End Function