Forum Discussion
running an exe file from a sub folder of LocalAppData
- Jan 25, 2023
If my answer solved your issue, please mark it as solution to mark this topic as solved
PowerShell isn't doing what you think it's doing.
You're expecting it to perform the concatenation of the two strings, then passing the resulting value in as the FilePath value. However, the first thing PowerShell does is parse the parameters, which means only the environment variable is passed in for FilePath, with the rest of the line being assumed to be parameters of some other description.
You should have been getting a helpful error though from PowerShell, as per the example below:
In the second example, you can see where I've used parenthesis to instruct PowerShell to do the concatenation of the string first, before passing the result of that concatenation in as the value for FilePath.
You will then need to split the executable command from the parameters as Harm_Veenstra has demonstrated above.
Cheers,
Lain