Forum Discussion
Run Start-Process with -ArgumentList when an argument also contains a -a
From looking at the error message, I tried this command (wrapping the -ArgumentList in quotes):
powershell Start-Process -FilePath "$env:PROGRAMDATA\GrapeCity\gclm\gclm.exe" "-ArgumentList 'product-id', '-a licensekey'";
And it works!
Thank you for your help!
Hi, Joe.
I'm glad it's working - that's all that matters, but there's some inconsistencies here.
From the second last post, the error's showing that there is no comma between the product key and the -a, which doesn't reflect the command you mentioned running:
Next, enclosing the entire ArgumentList component in double quotes causes everything - including the "-ArgumentList" to be treated as a single parameter to gclm.exe. This seems not to be an issue for gclm.exe, but it's important to understand what's going on as there will be other times this strategy won't work.
Here's an example, where I'm using the command prompt in lieu of gclm.exe.
Output
Here, you can see the whole string's been passed in as the parameter.
Cheers,
Lain