scripting - powershell - inserting 7-zip parameters as variables -


i trying run script archive specific directory , exclude type of files. problem if try insert of parameters main 7z command - parameters doesn't work here code:

$source = "c:\source" $destination = "d:\dest" $date = get-date -uformat "%d-%m-%y" $name = "d-"+$date+".zip" $excludefiletypes= "-x!'*.css' -x!'*.exe' -x!'*.dll' -x!'*.iso' -x!'*.ace' -x!'*.arj' -x!'*.jar' -x!'*.bz2' -x!'*.lha' -x!'*.lzh' -x!'*.rar' -x!'*.zip' -x!'*.tar' -x!'*.tgz'" 7z "$destination$name" "$source" -r $excludefiletypes -mx=9 

if replace $excludefiletypes value - 7z command works. have no idea problem. guess can't work variables that.

i had same issue while ago trying execute msi installers command line. try executing this:

$cmdargs = "a $destination$name $source -r $excludefiletypes -mx=9" start-process -filepath c:\tools\7z.exe -argumentlist $cmdargs 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -