Im trying to run the following code as a powershell script,but I cant get it to work. 1st,the following works with one -Include item but I cant seem to get it to work with multiple ones. 2nd, the -Exclude perimeter doesn't seem to work. I still get files from the C:\Windows and C:\Program Files directorys .
$Include = "*.zip","*.rar","*.tar","*.7zip"
$exclude = "C:\Windows","C:\Program Files"
Get-ChildItem "C:\" -Include $Include -Exclude $Exclude -Recurse -Force -ErrorAction silentlycontinue | Select-Object -ExpandProperty FullName
Note: The purpose of this script is to find all compressed files on the system. I know this is probably really simple but I just cant seem to get it to work.