How RPM quotes arguments on the command line

When RPM executes your command, it passes the command line to Windows as a string. It’s up to Windows and, eventually your program to decide if that string makes sense or not.

For this reason, RPM takes care to quote certain arguments so that Windows treats them as a single value, not multiple values. If you are familiar with Windows command lines and executing programs in the Windows command shell, then you are probably comfortable with this topic already.

Strictly for the sake of example, let’s say you wanted to take a look at the report file which RPM generates each time it starts, and updates when it shuts down. This file is "report.txt" and it’s in the RPM install folder. On my 64-bit Windows 10 system, the RPM install folder is

C:\Program Files\Brooks Internet Software\RPM

And of course, let’s say you are in a different directory. You can’t always run a program and find all your assets in the same directory.

If you typed this command:

more C:\Program Files\Brooks Internet Software\RPM\report.txt

Windows would correctly report:

Cannot access file C:\Program

The reason is that the "more" program tries to open its first argument as a file name. In this instance, the first argument is "C:\Program".

In order to make this command work the way we expect, we need to type:

more "C:\Program Files\Brooks Internet Software\RPM\report.txt"

Those quotes tell Windows that all the text between the quotes is one argument. However it happens Windows removes the quotes and does not attempt to open a file path that contains quotes. It works, and I don’t question it.

For this reason, RPM will automatically quote certain values if they contain spaces. These arguments include:

  • The full path for the program, that is, the executable
  • The full path for the print job file in %s
  • The filename part of the print job in %f
  • The control file name and path in %C

If you quote these values in the Arguments field, you will likely end up with double quotes, which will not give you the result you are looking for.

However, please take care to quote anything else which you know needs to be quoted.