Quantcast
Viewing all articles
Browse latest Browse all 14

Answer by George Yockey for Can you zip a file from the command prompt using ONLY Windows' built-in capability to zip files?

You can eliminate the risk of timing out during compression by polling for existence of the compression dialog window. This method also handles the user cancelling out of the compression window.

objShell.NameSpace(ZipFile).CopyHere(source)' Wait for compression window to openset scriptShell = CreateObject("Wscript.Shell")Do While scriptShell.AppActivate("Compressing...") = FALSE      WScript.Sleep 500 ' Arbitrary polling delayLoop  ' Wait for compression to complete before exiting scriptDo While scriptShell.AppActivate("Compressing...") = TRUE      WScript.Sleep 500 ' Arbitrary polling delayLoop

Viewing all articles
Browse latest Browse all 14

Trending Articles