cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ashahidi
Level 4

Passing directory to Custom Action executable

I have a custom action which passes in an argument of a directory (the location of where the files to be processed reside) to an executable which processes files.

I know the property of this folder [REPORTSERVER1] and the actual location of the folder is C:/Program Files/Program1/.

My issue is when I pass the argument with no quotes ( -directory=[REPORTSERVER1] ) I get an error due to the space between Program and Files as it treats C:/Program as the argument I'm passing.

If I do quotes around it ( -directory="[REPORTSERVER1]" ) I still get an error but now it gets the whole path but leaves a quote mark at the end like this:
C:/Program Files/Program1"

Is there some other combination of quotes/or tick marks that I need?
Labels (1)
0 Kudos
(5) Replies
Happy_Days
Level 7

Why don't you try MSI property: [ProgramFilesFolder] for "C:\Program Files"?

In your case, you can set:

-directory="[ProgramFilesFolder]\Program1"
0 Kudos
ashahidi
Level 4

Thanks for the suggestion however, the location is determined by user input so it won't always be the same. I know the location where it will install on my local test machine. The user basically picks which instance of SQL Server includes Reporting Services. If I physically put in the location with single quotes around it, it works fine so I tried it single quotes around the [REPORTSERVER1] property but that doesn't seem to work.
0 Kudos
Happy_Days
Level 7

Can you check the value of REPORTSERVER1 property (via MessageBox or in the log file) if it inherit the quotation from user input?
0 Kudos
KathyMorey
Level 10

I have run into the same issue. Since the property for a path has the closing slash, the second quote is "escaped" and therefore it doesn't think you have a quote at the end of the string, if that makes sense. That also explains why you get C:/Program Files/Program1" with an ending quote but no slash as your value.

Try -directory="[REPORTSERVER1] " with a space before the closing quote and see if that works for you.
0 Kudos
ashahidi
Level 4

I tried using -directory="[REPORTSERVER]\ReportServer" and this ended up working. I realized that I'll always know the secondary folder will be called ReportServer so the only variable was the [REPORTSERVER] property and that it is determined by the directory the user picks anyway so this worked out.

Thanks for the help!
0 Kudos