use*_*242 5 windows compression cmd.exe
我正在寻找一个命令行命令来压缩文件。我想将每个文件单独压缩为 filename.zip。
我发现的所有方法包括: http ://exchangeserverpro.com/powershell-script-iis-logs-cleanup/
和:
就在附近,但不完全是我需要的。有什么建议吗?如果可能的话,我希望在没有外部软件(如 7-zip)的情况下实现这一点。它可以是一个 Power shell 脚本。
为此,有一个简单的 cmd.exe 命令。(通过 PowerShell v5.0+)
压缩:
powershell Compress-Archive -LiteralPath 'C:\mypath\testfile.txt' -DestinationPath "C:\mypath\Test.zip"
Run Code Online (Sandbox Code Playgroud)
解压缩:
powershell Expand-Archive -LiteralPath "C:\mypath\Test.Zip" -DestinationPath "C:\mypath" -Force
Run Code Online (Sandbox Code Playgroud)
资料来源:
特别感谢@Ramhound
小智 0
无需任何第三方软件即可压缩文件
compact [{/c|/u}] [/s[:dir]] [/a] [/i] [/f] [/q] [FileName[...]]
有关更多信息,请检查以下链接 https://technet.microsoft.com/en-us/library/bb490884.aspx