#5、6です。
Office関連ファイルにも対応させました。
Dim FSO
Dim objArgs
Dim FPath
Dim MyObject
Dim Ex
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
FPath = objArgs(I)
If FSO.Fileexists(FPath) Then
If FSO.GetExtensionName(FPath) = "xls" Then
Set MyObject = Wscript.CreateObject("Excel.Application")
With MyObject
.Workbooks.Open (FPath)
.Visible = True
End With
ElseIf FSO.GetExtensionName(FPath) = "doc" Then
Set MyObject = Wscript.CreateObject("Word.Application")
With MyObject
.Documents.Open (FPath)
.Visible = True
End With
Else
Set Ex = CreateObject("Shell.Application")
Ex.Open FPath
End If
Else
Set Ex = CreateObject("Shell.Application")
Ex.Open FPath
End If
Next
Set FSO = Nothing
Wscript.Quit