-l 1-6 - specifies the length of passwords to tryįcrackzip version 1.-c a1:$% - specifies the character sets to use.Using it is pretty straightforward: $ fcrackzip -b -c a1:$% -l 1-6 -u myencrypted.zip It's in most Linux distro repos such as Ubuntu & Fedora/CentOS. ZipFile "C:\PF Credits.Just wanted to add another method using fcrackzip CLI tool. Parameters:-p encrypt and prompt for PW.-pPUTPASSWORDHERE (this replaces -p) if you want to preset the PW with no prompt. Depending on the release you have, 7z may be replaced with 7za in the syntax. Msg = "File Not Zipped - " & Msg & vbCrLf & "Error " & RetValĮxample of using the macro: Sub ZipTest() General Syntax: 7z a archivename target parameters Check your 7-Zip dir. Msg = "Invalid EXE file or error in EXE image" Msg = "Incomplete or invalid file association" RetVal = ShellExecute(0&, "", "WinZip32.exe", CmdLine, FilePath, 1&) ' Zip the file and save it in the archive ' Command line string - file names must include quotesĬmdLine = "-min -a -en " & Chr$(34) & ZipName & Chr$(34) & " " _ĬmdLine = "-min -a -en -s" & Chr$(34) & Password & Chr$(34) _ ZipName = FilePath & IIf(Ext = 0, FileName & ".zip", Left(FileName, Ext) & "zip") MsgBox "File Not Found" & vbCrLf & " " & FilePath & FileName ' If no path is specified use the current directoryįilePath = IIf(Path = 0, CurDir & "\", "") Sub ZipFile(FileName As String, Optional ByVal Password As String) Lib "Shell32.dll" Alias "ShellExecuteA" _ Here is the macro code along with an example of using it. You may find my version easier to use and understand. Msgbox "FileNameZip or/and FileNameXls exist", vbInformation, "zipping" Msgbox "completed zipped : " & vbNewLine & FileNameZip, vbInformation, "zipping" 'Keep script waiting until Compressing is doneĭo Until oApp.Namespace(FileNameZip).items.Count = 1Īpplication.Wait (Now + TimeValue("0:00:01")) OApp.Namespace(FileNameZip).CopyHere FileNameXls Set oApp = CreateObject("Shell.Application") If Dir(FileNameZip) = "" And Dir(FileNameXls) = "" Then Compress-7Zip -Path C:Scripts -ArchiveFileName Test. StrDate = Format(Now, " dd-mmm-yy h-mm-ss")įileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & strDate & ".zip"įileNameXls = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & strDate & ".xls" Actually you can use PowerShell and install 7Zip4Powershell module in order to create password protected zip file without having to install 7-Zip software. 'Create date/time string and the temporary xls and zip file name Msgbox "Please Save activeworkbook before zipping" & Space(12), vbInformation, "zipping" If ActiveWorkbook Is Nothing Then Exit Sub Of course, password protection is only as strong as the password itself. Hope this will help you: Sub zip_activeworkbook() Password protecting a Zip folder is like putting your valuables in a safe where you choose the combination, and it remains known only to you and the people with whom you choose to share it. Under the Add to Archive window, you need to: enter a name for the file, set an archive format, and enter an encryption solution. If the password doesn’t match, the Cancel argument is set to True, which means the folder isn’t displayed. Choose the file you want to compress, and right-click on it. If this folder’s name is Confidential, the procedure asks the user to enter the password. Any idea where do I put the -p command to make it work I tried but it is not working for me. This procedure accepts an argument named NewFolder, which represents the folder to which the user is trying to switch. How to add password command in zip bat file Ask Question Asked 4 years, 11 months ago Modified 2 years, 10 months ago Viewed 10k times 1 I have a script below which is working perfectly, all I need is to add a password & encryption while compressing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |