tonelm54
asked on
String Concatenation¿ not in right order
Im trying to write a function, which looks quite simple:-
Im calling it as:-
While should output as:-
However instead outputs as:-
What seems to be happening is all my variables Im passing through seem to be set as one instead of seperate, then its ignoring the others as null.
Any ideas what Im doing wrong with this please?
Thank you
function backupMySQL([String]$dbHost, [String]$dbUsername, [String]$dbPassword, [String]$dbName, [String]$emailFrom, [String]$emailTo, [String]$emailSubject)
{
$strCmd = "& 'C:\Utils\Powershell\MySQL\mysqldump.exe' -h $dbHost -u $dbUsername -p$dbPassword $dbName"
write-host $strCmd
}
Im calling it as:-
backupMySQL("dbHost", "dbUsername", "dbPassword", "dbName", "emailFrom", "emailTo", "emailSubject")
While should output as:-
& 'C:\Utils\Powershell\MySQL\mysqldump .exe' -h dbHost -u dbUsername -pdbPassword dbName
However instead outputs as:-
& 'C:\Utils\Powershell\MySQL\mysqldump .exe' -h dbHost dbUsername dbPassword dbName emailFrom emailTo emailSubject -u -p
What seems to be happening is all my variables Im passing through seem to be set as one instead of seperate, then its ignoring the others as null.
Any ideas what Im doing wrong with this please?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.