Powershell execute file with path in parameters -
i trying run sqlpackage.exe powershell using variable string sourcefile parameter:
$fileexe = "c:\program files (x86)\microsoft sql server\120\dac\bin\sqlpackage.exe" & $fileexe /action:publish /sourcefile:$outputvariable\file.dacpac /profile:c:\sql\file.sqldatabase.publish.xml
where $outputvariable folder containing full path
unfortunately following error:
sqlpackage.exe : *** illegal characters in path. @ c:\powershell\test.ps1:20 char:6 + & $fileexe /action:publish /sourcefile:$outputvariable\file.dacpac /profile:c ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (*** illegal characters in path.:string) [], remoteexception + fullyqualifiederrorid : nativecommanderror
i tried surrounding quotes , splitting parameters did not solution. idea?
thanks in advance!
apparently trimming $outputvariable
$outputvariable.trim()
the problem fixed.
Comments
Post a Comment