Eternal21
Posts: 21
Joined: Mon Aug 15, 2016 5:51 pm

How do I add command line arguments to 'Run powershell script file' custom action?

Tue Apr 20, 2021 9:22 pm

I don't see a way to specify command line arguments for 'Run powershell script file' custom action. You can only do it if you are using a 'Launch File' custom action, or 'Run Powershell Inline Script' action.

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: How do I add command line arguments to 'Run powershell script file' custom action?

Mon Apr 26, 2021 10:33 am

Hello,

Unfortunately, I am not quite sure I fully understand your scenario here.

Could you please give me some more details about what you are trying to achieve?
You can only do it if you are using a 'Launch File' custom action, or 'Run Powershell Inline Script' action.
I believe what you are mentioning here is different.

The "Command Line" field for the "Launch File" custom action is indeed used to pass a parameter to your launched file. For instance, if you launch an MSI file, you can pass the "/qn" parameter to it. On the other side, the "Parameter values" field from the "Run inline PowerShell script" custom action is used to be able to use a property's value during the deferred stage (where most properties are not available).

For instance, if your powershell script is scheduled to run during the deferred stage and you are trying to retrieve the value of the APPDIR property, it will fail because the property is not available during that stage. However, if we pass it to the script through the "Parameter values" field, we will be able to use its' value (please refer to our "How to Use CustomActionData to Access Windows Installer Properties in Deferred CustomActions" article for more information).

Looking forward to hearing from you!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”