Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Powershell module for creating and extracting 7-Zip archives

License

NotificationsYou must be signed in to change notification settings

thoemmi/7Zip4Powershell

Repository files navigation

Powershell module for creating and extracting 7-Zip archives supporting Powershell'sWriteProgress API.

Screenshot

Important

Please note that this repository is not maintained anymore. I've created it a coupleof years ago to fit my own needs (just compressing a single folder). I love that lotsof other users find my package helpful.

I really appreciated if you report issues or suggest new feature. However,I don't use this package myself anymore, and I don't have the time tomaintain it appropriately. So please don't expect me to fix any bugs. Any PullRequest is welcome though.

Usage

The syntax is simple as this:

Expand-7Zip    [-ArchiveFileName]<string>    [-TargetPath]<string>    [-Password<string>]| [-SecurePassword<securestring>]    [<CommonParameters>]Compress-7Zip    [-ArchiveFileName]<string>    [-Path]<string>    [[-Filter]<string>]    [-OutputPath]<string>    [-Format<OutputFormat> {Auto| SevenZip| Zip| GZip| BZip2| Tar| XZ}]    [-CompressionLevel<CompressionLevel> {None| Fast| Low| Normal| High| Ultra}]    [-CompressionMethod<CompressionMethod> {Copy| Deflate| Deflate64| BZip2| Lzma| Lzma2| Ppmd|Default}]    [-Password<string>]| [-SecurePassword<securestring>]    [-EncryptionMethod<ZipEncryptionMethod> {ZipCrypto| Aes128| Aes192| Aes256}]    [-CustomInitialization<ScriptBlock>]    [-TempFolder<string>]    [-IncludeHidden]    [-IncludeSystem    [-EncryptFilenames]    [-VolumeSize<int>]    [-FlattenDirectoryStructure]    [-SkipEmptyDirectories]    [-PreserveDirectoryRoot]    [-DisableRecursion]    [-Append]    [<CommonParameters>]Get-7Zip    [-ArchiveFileName]<string[]>    [-Password<string>]| [-SecurePassword<securestring>]    [<CommonParameters>]Get-7ZipInformation    [-ArchiveFileName]<string[]>    [-Password<string>]| [-SecurePassword<securestring>]    [<CommonParameters>]

It works with both x86 and x64 and usesSevenZipSharp as a wrapper around 7zip’s API.

Jason Fossen wrote the articlePowerShell 7-Zip Module Versus Compress-Archive with Encryptionwhere he describes some usage scenarios with 7Zip4PowerShell.

Where to get it

7Zip4Powershell is published atPowerShell Gallery.

https://www.powershellgallery.com/packages/7Zip4Powershell

Customization

Compress-7Zip accepts a script block for customization. The script block gets passed the currentSevenZipCompressor instance. E.g. you can set the multithread mode this way:

$initScript= {param ($compressor)$compressor.CustomParameters.Add("mt","off")}Compress-7Zip-Path.-ArchiveFileName demo.7z-CustomInitialization$initScript

A list of all custom parameters can be foundhere.

Changelog

[v2.7]

  • Updates of 7-Zip libraries to version 24.09 (contributed by@kborowinski in#92)

[v2.6]

  • Updates of 7-Zip libraries to version 24.08 (contributed by@kborowinski in#91)

[v2.5]

  • Workaround for NullReferenceException when extracting multiple 7zip archives simultaneously on PS 7.4.0 (contributed by@kborowinski in#89)
  • Adds new parameterEncryptionMethod toCompress-7Zip
  • Updates of 7-Zip libraries to version 24.06 (support for ZSTD decompression ) (contributed by@kborowinski in#90)
  • Updates Squid-Box.SevenZipSharp nuget package to version 1.6.2.24 (final release -the project has been archived) (contributed by@kborowinski in#90)
  • Adds support for Wim (contributed by@pysj in#87)
  • Updates 7-Zip libraries to 22.01 and NuGet packages (contributed by@kborowinski in#84)
  • AddsTempFolder parameter toCompress-7Zip (requested in#78)
  • Now based on .NET Standard 2.0 (thanks to@kborowinski for testing)
  • Uses PowerShell 5 reference assembly, which reduces the package size dramatically(#61, contributed by@kborowinski)
  • ReplacesSevenZipSharp.Net45 withSquid-Box.SevenZipSharp library and adds new parameterPreserveDirectoryRoot forCompress-7zip.(#57, contributed by@kborowinski)
  • Adds new parameterOutputPath forCompress-7Zip(#60, contributed by@iRebbok)
  • Updated 7-Zip dlls to 16.04
  • Disabled theCustomInitialization parameter forExpand-7Zip, will be removed in future versions.

January 25, 2017

  • Added optionalSecurePassword parameter of typeSecureString to all cmdlets. (#34, #36)

October 27, 2016

  • Compression with password encryption could cause an exception (#33)

October 16, 2016

  • IfFormat is not specified, it is inferred from the file extension ofArchiveFileName (#24, proposed by @onyxhat)
  • Added new parameterVolumeSize to specify the colume size forCompress-7Zip (#25, proposed by @rgel)
  • Added new switchesFlattenDirectoryStructure,SkipEmptyDirectories, andDisableRecursion toCompress-7Zip (#27, contributed by @itmagination)
  • Added new switchAppend toCompress-7Zip to append files to an existing archive (#30, inspired by @itmagination)

June 15, 2016

  • addedGet-7ZipInformation cmdlet
  • use default compression method inCompress-7Zip (previously it was PPMd, for whatever reason) (#11)
  • allow piped input forGet-7Zip (#15)
  • useWriteDebug instead ofWrite of logging (#13)

June 5, 2016

  • Added parameter-EncryptFilenames toCompress-7Zip (#10, requested by @JasonFossen)

May 29, 2016

  • AddedGet-7Zip to get a list of files in an archive (#9, contributed by @gigi81)

30 March, 2016

  • AddedPassword parameter to bothCompress-7Zip andExpand-7Zip (#8)

Motivation

I've written and maintaining the module just for fun and to serve my own needs. Ifit's useful for you too, that's great. I don't demand anything in return.

However, if you like this module and feel the urge to give something back, a coffeeor a beer is always appreciated. Thank you very much in advance.

PayPal.me


[8]ページ先頭

©2009-2025 Movatter.jp