なんでもいいからアップして添削してもらうスレ

このエントリーをはてなブックマークに追加
Option Explicit
Dim Noah, objParm, objShell, objFolder, WshShell, i

'Noah本体の場所を指定
Noah = "D:\appl\noah3193\Noah.exe"

'渡されたファイルの処理
Set objParm = Wscript.Arguments
If objParm.Count < 1 Then
    WScript.echo "ファイルをドラッグ&ドロップしてください。"
    WScript.Quit()
End If

'展開先のフォルダを選択
set objShell = WScript.CreateObject("Shell.Application")
set objFolder = objShell.BrowseForFolder(0, "展開先のフォルダを選択", 0, "c:\\")
If (objFolder Is Nothing) Then
    WScript.Quit()
End If

'ファイル毎にオプションをつけてNoahを起動
Set WshShell = CreateObject("WScript.Shell")
For i=0 To objParm.Count-1
    WshShell.Run Noah & " -x " & _
      Chr(34) & "-d" & objFolder.Items().Item().Path & Chr(34) & " " & _
      Chr(34) & objParm(i) & Chr(34), 1, True
Next

'終了処理
Set objParm = Nothing:set objShell = Nothing:Set WshShell = Nothing