PowerShell で zip アーカイブを作成するにはどうすればいいですか? 質問する

PowerShell で zip アーカイブを作成するにはどうすればいいですか? 質問する

PowerShell を使用して zip アーカイブを作成することは可能ですか?

ベストアンサー1

PowerShell v5.0では、Compress-ArchiveそしてExpand-Archiveコマンドレット。リンクされたページには完全な例がありますが、要点は次のとおりです。

# Create a zip file with the contents of C:\Stuff\
Compress-Archive -Path C:\Stuff -DestinationPath archive.zip

# Add more files to the zip file
# (Existing files in the zip file with the same name are replaced)
Compress-Archive -Path C:\OtherStuff\*.txt -Update -DestinationPath archive.zip

# Extract the zip file to C:\Destination\
Expand-Archive -Path archive.zip -DestinationPath C:\Destination

おすすめ記事