Trying to use Powershell to execute a script on a specific database and server.
I can successfully get it to work but whenever I introduce a colon ":" for a path into a script variable it fails!!!!
This Works:
$MyVar = "C\TEST\"
&'sqlcmd' -v MyPath = "'$MyVar'" -S $server -d $masterDatabase -E -b -i $script_01
This does not:
$MyVar = "C:\TEST\"
&'sqlcmd' -v MyPath = "'$MyVar'" -S $server -d $masterDatabase -E -b -i $script_01
I can pick up the script variable in the script but only if I do NOT use a colon.