アットウィキロゴ

WSH_01

If WScript.Arguments.Count = 0 Then WScript.Quit
Set FS = CreateObject("Scripting.FileSystemObject")
Set SA = CreateObject("Shell.Application")

'圧縮ファイル名を作成します
FileName = Year(Date) & _
  Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & _
  Right("0" & Hour(Time),2) & Right("0" & Minute(Time),2) & _
  Right("0" & Second(Time),2) &  ".zip"
ZipFile = Replace(WScript.ScriptFullName, WScript.ScriptName, FileName)

'新しいzipファイルを作成します
With FS.CreateTextFile(ZipFile)
  .Write "PK" & Chr(5) & Chr(6) & String(18,0)
  .Close
End With

'zipファイルに引数で受け取ったファイルを入れます
i = 0
With SA.NameSpace(ZipFile)
  For Each file In WScript.Arguments
    .CopyHere file
    i = i + 1
    Do Until .Items.Count = i
      WScript.sleep 100
    Loop
  Next
End With

WScript.Echo "Done.."
最終更新:2013年04月25日 01:28