cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
manoj241176
Level 2

How to read command line argument in deferred custom action VBA?

Jump to solution

Hi,

I'm new to InstallShield software, and looking for help to read out command prompt arguments in my deferred custom action written in VBA. I'm looking to delete folder based on the command line arguments supplied by user.

I have created property named "RemoveFolder" which has default value as "false" and based on the user input this property value will be changed.

Command line argument: msiexe /i "mysamplemsi.msi" RemoveFolder=true 

I'm looking to set the property value in VBA code based on the user input.

Below VBA code snippet I'm trying to use for this operation.

Set oFso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Err.Clear

strRemoveFolder = RemoveFolder --------NOT SURE HOW TO READ COMMAND LINE ARGUMENT OR SET PROPERTY VALUE BASED ON USER INPUT TO READ THE SAME

If oFso.FolderExists(strFolderdelete) Then
Set folder = oFso.GetFolder(strFolderdelete)
If (strRemoveFolder ="1" Or strRemoveFolder ="true") Then
For Each subFolder in folder.SubFolders
subFolder.Delete True
Next
End If
End If

Any help is appreciated.

Labels (1)
0 Kudos
(1) Solution
manoj241176
Level 2

I've figured out the reason for not getting the property value in deferred custom action. I changed the property declaration from Normal-Casing to CAPTIAL casing i.e. from private property to public property. 

Before: RemoveFolder

After: REMOVEFOLDER

By doing this, I'm now able to read command line parameter value through my public property.

Deferred Execution Custom Action Cannot Retrieve a Property Value - Community (flexera.com)

https://learn.microsoft.com/en-us/windows/win32/msi/restrictions-on-property-names

 

View solution in original post

0 Kudos
(1) Reply
manoj241176
Level 2

I've figured out the reason for not getting the property value in deferred custom action. I changed the property declaration from Normal-Casing to CAPTIAL casing i.e. from private property to public property. 

Before: RemoveFolder

After: REMOVEFOLDER

By doing this, I'm now able to read command line parameter value through my public property.

Deferred Execution Custom Action Cannot Retrieve a Property Value - Community (flexera.com)

https://learn.microsoft.com/en-us/windows/win32/msi/restrictions-on-property-names

 

0 Kudos