0
START /high /d "./files" "Program Name.exe"  

This doesn't work, it works if "Program Name" wasn't in quotation marks, but in this scenario i don't have control over the file name and where the batch file gets executed. How would i solve this using Batch?

Henrik
  • 392
  • 2
  • 13
  • This is because the `start` command treats the first quoted argument as the Console title, provided that the quoted argument does not belong to any of the command line switches. You can provide a dummy title(or an empty one) to not interfere with the quoted executable name: `START "title" /high /d "./files" "Program Name.exe"` – sst May 09 '20 at 23:40
  • This worked, thank you! :) – Henrik May 09 '20 at 23:42

1 Answers1

0

Though it's not explicitly stated in the help text from start /?:

START ["title"] [/D path] ...

the first quoted option is treated as the title for the window. In your case, that's the (supposed) executable name.

You can see that if you create an x y.cmd file containing only the command @dir, then run:

start /d "\program files" "\path\to\x y.cmd"

The directory \path\to above is the directory where you created it, needed because you'll actually be in the program files directory when you try to run it.

What you'll see is not a directory listing (because the script isn't running), but a new cmd window titled \path\to\x y.cmd.

If you instead use:

start "xyzzy" /d "\program files" "\path\to\x y.cmd"

you'll find that it does run the script, giving you a directory in a window titled xyzzy.

In other words, if you want to quote your program name, you should provide an actual title so there's no confusion.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953