Single line folder for unpacking in PowerShell?

I am looking for an equivalent PowerShell command for:

tar -zcvf tar-archive-name.tar.gz source-folder

Is there a single line file that creates a zip file from a folder that recursively adds content source-folderthat does not require a third-party library like 7-zip?

+5
source share
2 answers

Starting with Powershell 5 , you can use the built-in Compress-Archive:

Compress-Archive -Path source-folder -DestinationPath archive-name.zip

powershell 5, liner , 7-zip. , zipping Windows, COM-, powershell . , .

+4

, zip-, -liner , tar. , ​​ , - PowerShell, PowerShell. , - , , zip, , , ! , , help about_pscx. , :

Write-Zip
    Create ZIP format archive files from pipline or parameter input. 
Write-GZip
    Create GNU ZIP (GZIP) format files from pipeline or parameter input. 
Write-Tar
    Create Tape Archive (TAR) format files from pipeline or parameter input. 

, , :

PS> dir c:\logs\ -rec -inc *.log | write-zip -level 9 -removeoriginal
PS> dir c:\logs\ -rec -inc *.log | write-tar -output logs.tar | write-gzip -level 9 | move-item c:\archived_logs\
+4

All Articles