I am having an issue with a powershell script. The script set parameter and tries to execute a .bat file passing in the parameters.
$app='test.bat';
$appLoc='C:\scripts';
$arg1='userid';
$arg2='password';
$arg3='filelocation';
$arg= $arg1 + $arg2 + $arg3;
Set-Location $appLoc;
I have tried everything to run the batch script passing in the parameters using
& $app $arg
& $app -ArgumentList $arg
Start-Process $app -ArgumentList $arg -wait -passthru
& $app $arg1 $arg2 $arg3
All four statements above is failing. It looks like it is only executing the batch script and not passing in the parameters.