VBAで.netFrameworkを使ったzip圧縮と解凍のサンプル(2GB以上対応)

PowerShell

VBAでzip

CopyHere メソッドから Zip ファイルを処理することはできません – Microsoft サポート

VBAでZIP圧縮と解凍を行う | Excel作業をVBAで効率化 (vbabeginner.net)

PowerShell V5で2GBを超えるzipファイル作成 – Qiita

ZipFile クラス (System.IO.Compression) | Microsoft Learn

Compress-Archive (Microsoft.PowerShell.Archive) – PowerShell | Microsoft Learn

Powershell版(ZipFileクラス利用サンプル) .zip ファイルを作成して抽出 – Serene diary almost day-to-day (papanda925.com)

Add-Type -AssemblyName System.IO.Compression.FileSystem

$dir = "C:\Users\papanda925\OneDrive\デスクトップ\新しいフォルダー (6)\VSCode-win32-x64-1.67.2 - コピー"
$zipFile = "C:\Users\papanda925\OneDrive\デスクトップ\新しいフォルダー (6)\VSCode-win32-x64-1.67.2 - コピー.zip"

if (Test-Path $dir) {
  Remove-Item $dir -Force -Recurse
}


Add-Type -AssemblyName System.IO.Compression.FileSystem
[IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $dir,[Text.Encoding]::Default)
Add-Type -AssemblyName System.IO.Compression.FileSystem

$dir = "C:\Users\papanda925\OneDrive\デスクトップ\新しいフォルダー (6)\VSCode-win32-x64-1.67.2 - コピー"
$zipFile = "C:\Users\papanda925\OneDrive\デスクトップ\新しいフォルダー (6)\VSCode-win32-x64-1.67.2 - コピー.zip"


if (Test-Path $zipFile) {
  Remove-Item $zipFile -Force
}


[IO.Compression.ZipFile]::CreateFromDirectory($dir, $zipFile, [IO.Compression.CompressionLevel]::Optimal, $true, [Text.Encoding]::Default)
ライセンス:本記事のテキスト/コードは特記なき限り CC BY 4.0 です。引用の際は出典URL(本ページ)を明記してください。
利用ポリシー もご参照ください。

コメント

タイトルとURLをコピーしました