# Prompt the user to paste the list of folders to compress from the clipboard $folders = Read-Host "Please paste the list of folders to compress from the clipboard and press Enter" # Set the compression level (Valid values are low, medium, high, max, or blank for default) $level = "high" # Set the recursive option (Valid values are /S or blank for no recursion) $recursive = "/S" # Loop through the folders and invoke compact.exe for each one foreach ($folder in $folders) { # compact.exe uses advanced compression algorithms to compress the files and folders # The compression level determines which algorithm is used and how much space is saved # The pros and cons of each compression level are as follows: # low: Low compression, uses XPRESS4K, saves some space, fast and low CPU usage # medium: Medium compression, uses XPRESS8K, saves more space, moderate speed and CPU usage # high: High compression, uses XPRESS16K, saves even more space, slow and high CPU usage # max: Maximum compression, uses LZX, saves the most space, very slow and very high CPU usage compact /C /S /A /I /EXE:$level $recursive $folder }