0

I was using start-process cmdlet in powershell as

Start-Process -FilePath "$Installer_Path" -Args '/s /v"/qb SETUPTYPE=\"$Setup_type\" USERNAME=$user_name PASSWORD=$password SERVER=$sql_server INSTALLDIR=\"$Transfer_Path\\\" SHAREPATH=\"$Transfer_Path\\\""' –Wait

In the above command the variable are not getting replaced except $Installer_Path. I believe issue is because of variables located inside ' " " '. Could any one help me with the variable substitution?

Thanks.

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
workholic
  • 115
  • 2
  • 4
  • 12

1 Answers1

0

The problem is that you are using single quotes and not double quotes. In order for your variables to expand you need to use double quotes. If you have to use double quotes inside of those you can escape them by preceding them with a backtick ` or by doubling them up "".

Start-Process -FilePath "$Installer_Path" -Args "/s /v`"/qb SETUPTYPE=\`"$Setup_type\`" USERNAME=$user_name PASSWORD=$password SERVER=$sql_server INSTALLDIR=\`"$Transfer_Path\\\`" SHAREPATH=\`"$Transfer_Path\\\`"`"" –Wait
TheMadTechnician
  • 34,906
  • 3
  • 42
  • 56