vbscript to winzip a file with password code example

Example: vbscript to winzip a file with password

strWinZipDir = "C:\Program Files\WinZip\WINZIP64.exe"
strZipFileToCreate = LocalPath & "FileName.zip"
strFilesToZip  = LocalPath & "*.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")

strWinZip = objFSO.GetFile(strWinZipDir).ShortPath
strCommand = strWinzip & " -min -a -s""Password"" -r """ & strZipFileToCreate & """ " & strFilesToZip

Set objShell = CreateObject("WScript.Shell")
Set objExec = objShell.Exec(strCommand)

Do While objExec.Status = 0
 Wscript.Sleep(200)
Loop

Set objShell = Nothing
Set objExec = Nothing
Set objFSO = Nothing