Building from cmd line with space in compiler variable

Got a problem you cannot solve? Try here.
Post Reply
Erik
Posts: 28
Joined: Thu Mar 12, 2009 4:55 am

Building from cmd line with space in compiler variable

Post by Erik »

I have a project which I want to build from the command line. This project has a number of compiler variables that I want to set using the normal VARIABLE=VALUE method on the command line. In some cases I want to use spaces in these variables but I haven't been able to make that work properly.

The scenario is the following, I normally build using something similar to this:
miabuild myproject.mpr PRODUCTNAME=MySoftware

This works fine. However, when I want to build something like this:
miabuild myproject.mpr PRODUCTNAME=MySoftware Special Edition

it doesn't work. I've tried putting whole variable expression inside quotes ("PRODUCTNAME=MySoftware Special Edition") as well as just the string (PRODUCTNAME="MySoftware Special Edition") but without luck.

What happens is that I get an installer package that mostly looks right but when running it I get an error during the installation phase. It says:
A portion of the folder path" is invalid. It is either empty or exceeds the length allowed by the system.

This variable is used all over the place, including the title field and some create shortcut commands but I haven't been able to pinpoint which command it fails on.

If I use the project properties dialog to edit the compiler variable it works fine using the spaces. Does anyone know how I should do this?

I have a log file from the installation if there is any interest in seeing it but it contains a bunch of names and stuff so I'd rather not post it in its entirety. If you would like to see it I can email it or if there is any particular section of interest I could put it up here. I've attached an image of the error as well.

Thanks in advance.

File Attached:

iaerror.jpg
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

This is simply an error in passing command line parameters. The operating system separates/parses command line parameters by spaces. If you would like to include parameters with spaces, then enclose the entire parameter string inside double quotes. So for instance, myapp.exe param1 "long param 2" param3 will pass three command line variables; excluding the double quote characters will pass five command line parameters instead, producing an undesired result.

So in InstallAware, use the similar form "VARIABLE=VALUE".
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Erik
Posts: 28
Joined: Thu Mar 12, 2009 4:55 am

Post by Erik »

MichaelNesmith wrote:So in InstallAware, use the similar form "VARIABLE=VALUE".
Thanks for your reply.
I'm sorry but I guess I wasn't clear enough in my explanation. This is what I've been doing and it didn't work.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Are the compiler variables also defined in the Project Options window?
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Erik
Posts: 28
Joined: Thu Mar 12, 2009 4:55 am

Post by Erik »

MichaelNesmith wrote:Are the compiler variables also defined in the Project Options window?
They are.

If I give them a default value that includes a space in the options window everything works fine, it's just when I try to override it from the command line things go wrong.
Post Reply