Question

If I run:

<somecommand> -e "SHOW DATABASES" -u<user> -p<password>

It runs. But if I try:

<somecommand> -e "SHOW DATABASES" -u$sqlUser -p$sqlPassword

it fails because the variables are not being expanded.

What is the simplest way to accomplish this task in powershell?

Était-ce utile?

La solution

Assuming somecommand is an exe (or DOC command as you state), try it this way:

<somecommand> -e "SHOW DATABASES" "-u$sqlUser" "-p$sqlPassword"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top