FANDOM


When passing filenames to programs using runCommand or runCommandInBg, it is important to put quotation marks around filenames with spaces or other special characters. You can use the following function to put double-quotes (") around your filenames before passing them in a runCommand string.

function quoteFilename(str)
{
  return "\"" + str.replace(/[\\"]/g, "\\$&") + "\"";
}


ExampleEdit

This will start Adobe Reader 7.0 on Windows:

var path = "C:/Program Files/Adobe/Acrobat 7.0/Reader/AcroRd32.exe";
runCommand("start " + quoteFilename(path));

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.