Reputation: 82517
I am looking for the 7-zip command line call that is the equivalent to the explorer extension option of Add to "FolderName.zip"
:
I have tried:
& 7z C:\path\To\SecondAttempt, C:\path\to\SecondAttempt.zip
And I get the following
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
Command Line Error:
Unsupported command:
C:\path\to\SecondAttempt,
Does anyone know the command line equivalent of the explorer extension for 7-Zip?
Upvotes: 0
Views: 1563
Reputation: 73846
The shell extension invokes 7zG.exe
, a GUI utility that shows a nice GUI window if this is what you were looking for. Using SysInternal ProcMon it's possible to look up the command line used, basically:
& "C:\Program files\7-Zip\7zG.exe" a -tzip -slp- "a.zip" "file1.txt" "file2.txt"
@
instead of the file names.-slp-
disables large page mode, and -slp
enables compression speedup of large filesUpvotes: 4
Reputation: 880
Fo 7Zip this should be the correct syntax
. .\7z.exe a C:\path\to\SecondAttempt.zip "C:\path\To\SecondAttempt"
But I would prefer to use directly .NET
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory("C:\path\To\SecondAttempt","C:\path\to\SecondAttempt.zip")
Upvotes: 2