Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
const ForWriting = 2
if wscript.arguments.count < 2 then
WScript.echo "Usage: <zipfile> <copydir>"
WScript.quit
end if
set objFSO = CreateObject("Scripting.FileSystemObject")
zipfile = objFSO.GetAbsolutePathName(WScript.arguments(0))
copydir = objFSO.GetAbsolutePathName(WScript.arguments(1))
WScript.echo "Output: " & zipfile
WScript.echo "Input : " & copydir
' Create an empty zip file
set objZipfile = objFSO.OpenTextFile(zipfile, 2, VBTrue)
call objZipfile.Write("PK" & chr(5) & chr(6) & String(18,0))
objZipfile.Close
' Copy to zip file
set objShell = CreateObject("Shell.Application")
set dstdir = objShell.NameSpace(zipfile)
set srcs = objShell.NameSpace(copydir).items
dstdir.CopyHere srcs
do until dstdir.items.count = srcs.count
WScript.Sleep 1000
loop
' Tidy up
set objShell = Nothing
set objFSO = Nothing
const ForWriting = 2
zipfile=inputbox("zip file")
copydir=inputbox("source dir")
set objFSO = CreateObject("Scripting.FileSystemObject")
zipfile = objFSO.GetAbsolutePathName(zipfile)
copydir = objFSO.GetAbsolutePathName(copydir)
WScript.echo "Output: " & zipfile
WScript.echo "Input : " & copydir
' Create an empty zip file
set objZipfile = objFSO.OpenTextFile(zipfile, ForWriting, VBTrue)
call objZipfile.Write("PK" & chr(5) & chr(6) & String(18,0))
objZipfile.Close
' Copy to zip file
set objShell = CreateObject("Shell.Application")
set dstdir = objShell.NameSpace(zipfile)
set srcs = objShell.NameSpace(copydir).items
dstdir.CopyHere srcs
do until dstdir.items.count = srcs.count
' Increase to 1s.
Script.Sleep 1000
loop
' Tidy up
set objShell = Nothing
set objFSO = Nothing
[blue]Option Explicit
Dim pathname
Dim FolderName
pathname=inputbox("enter folder name:") [COLOR=green]' zip file will go in parent of this folder[/color]
FolderName = pathname
CreateEmptyZip pathname & ".zip"
With CreateObject("Shell.Application")
.Namespace(pathname & ".zip").CopyHere .Namespace(FolderName).items
Do until .Namespace(pathname & ".zip").Items.Count>0 [COLOR=green]' does not deal well with empty source folder ...[/color]
wscript.Sleep 1000
loop
End With
[COLOR=green]' All done![/color]
Public Sub CreateEmptyZip(sPath)
Dim strZIPHeader
strZIPHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, 0)
With CreateObject("Scripting.FileSystemObject")
.CreateTextFile(sPath).Write strZIPHeader
End With
End Sub[/blue]