I'm using advanced installer for creating msi package I want copy some files and folders after installation completed to "[APPDIR]" (I know I can do this with add files and folder to files and folder section in advanced installer but I don't want to do that because my files and folder are dynamic in each installation in customer machine) I write an inline PowerShell script like below
> Param( [string] $source, [string] $dest )
$exclude = @('web.config')
> Get-ChildItem $source -Recurse -Exclude $exclude | Copy-Item
> -Destination {Join-Path $dest $_.FullName.Substring($source.length)}
and in the parameter section, I fill like this "[SourceDir]Project", "[APPDIR]Project"
but it doesn't work. Why?
Abbas has since confirmed that the problem was one of command-line (parameter) syntax:
The parameter section - what to pass to the PowerShell script from Advanced Installer - was filled in as:
"[SourceDir]Project", "[APPDIR]Project" # !! WRONG, due to the comma
whereas it should have been:
"[SourceDir]Project" "[APPDIR]Project" # OK: *space-separated* arguments
Calling scripts/functions/cmdlets in PowerShell works as it does in shells, not as in programming languages; that is, you must separate the arguments being passed with spaces.
By contrast, using ,
between tokens constructs an array that is passed as a single argument.
From PowerShell run Get-Help about_Command_Syntax
for more information.