Invoke 7zip followed by a custom line of arguments

Sep 9, 2010 at 12:35 AM
Edited Sep 9, 2010 at 5:54 AM

Very intersting your script. I testing and reading your script.

I see this(Lines 1490-1493):
    # For reasons beyond the boundaries of my comprehension I was not able
    # to properly invoke 7zip followed by a custom line of arguments.
    # Therefore I choose to write down the command as a batch file and
    # launch it.

This work for me:

$CmdLine=Anything (With correct format, double quota, etc)



$CmdLine= """C:\Program Files\7-Zip\7z.exe"" a -t7z -m0=LZMA2 -mmt=on -mx9 -md=128m -mfb=273 -ms=on -ssw -sccUTF-8 ""-pPassWord"" -mhe=on -v41943040 ""File.7z"" ""File One"" ""File Two"" ""Folder One"" ""Folder Two"""




PD. Another solution (with more PS spirit :

$7zip=@("C:\Program Files\7-Zip\7z.exe")

$Params=@("a", "-t7z", "-m0=LZMA2", "-mmt=on", "-mx9", "-md=128m", "-mfb=273", "-ms=on", "-ssw", "-sccUTF-8", """-pPassWord""", "-mhe=on", "-v41943040", """File.7z""", """File One""", """File Two""", """Folder One""", """Folder Two""")

&$7zip $Params

Nov 30, 2010 at 6:33 PM

Hi renegm,

I missed your post and ... thank you, I appreciate it.

However the problem I encountered is in the fact that I build a list of files to be compressed and write them down in a plain text file which has to be passed to 7zip  using the "@" as a prefix. This messes things up.