I want to zip a folder using batch file. Here's my code for zip.bat:
CScript zip.vbs E:\app E:\app.zip
zip.vbs has the following code:
Set objArgs = WScript.Arguments
InputFolder = objArgs(0)
ZipFile = objArgs(1)
'Create empty ZIP file.
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)
'Required!
wScript.Sleep 2000000
This code is ziiping the folder properly but i dont want to mention any drive name. I want that in any drive if i keep my bat file n app folder then after running the bat file it should zip the folder. Is there any code for this???