When run from the script, it resolves the $envProgramFiles to C:\Program Files correct and the
$dirFiles correctly and tries to run the command. It comes back with exit code of 0, but no package is installed.
When I run the same command from a command prompt, I have to use:
You’re missing a quotation mark in your command. It should be like this:
Execute-Process -Path “$envProgramFiles\R\R-3.2.1\bin\R.exe” -Parameters “CMD Install $dirFiles\nameofpackage.zip”
Also, in case $dirFiles has spaces in it, you should probably also do this:
If you got an illegal character failure for using `, then it was specified improperly. I don’t think there is a problem with the $envProgramFiles path. If Execute-Process is executing the exe and returning a 0 exit code, then I assume the package is being executed with the correct commandline. Question is why it doesn’t behave as expected and install the application. Is there a log that is generated?