Below is a small VB script that I believe should zip files in a folder. I am new to VB script.
Set objArgs = WScript.Arguments
InputFolder = objArgs(0)
ZipFile = objArgs(1)
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set objShell = CreateObject("Shell.Application")
Set source = objShell.NameSpace(InputFolder).Items
objShell.NameSpace(ZipFile).CopyHere(source)
wScript.Sleep 2000
I found the script here. Batch file script to zip files
I run the script with the following
CScript zipt.vbs ..\AFolder AFolder.zip
I get the following error:
zipIt.vbs(6, 1) Microsoft VBScript runtime error: Object required
: 'objShell.NameSpace(...)'
..\AFolder
is not empty. The zip file is created and is empty.
Debugging the script, the error is on this line.
Set source = objShell.NameSpace(InputFolder).Items
What does the error message mean?