5

I would like to create shortcuts to some executable files (exe, bat, com...) on Windows 7 using bat files, but I had some troubles with that:

  1. start notepad.exeworks perfectly, but start Foxit Reader.exe or start "Foxit Reader.exe" will not function. How to use start command with files named with space characters?

  2. call notepad.exe or start "Foxit Reader.exe" or just notepad.exe or "Foxit Reader.exe" works but a command prompt is opened and remains opened until the user close it or called executable. Any way to avoid it?

3 Answers 3

5

Read help for start carefully. And start does not wait for started process termination by default (there is /wait flag for "waiting" mode).

start "" "Foxit Reader.exe"
2
  • Oh my! If I could put that question eligible for bounty today, I would assign 50 points to you :)
    – kokbira
    Aug 22, 2012 at 19:25
  • Note to self: Type faster.
    – Mark Allen
    Aug 22, 2012 at 20:04
4

Start seems to take the first parameter as the title if there's a space in it.

So while this did not work for me:

start "c:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe"

This did: start "" "c:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe"

1
  • 1
    Although @maximus answered at first, your answer explain why start does not function with quotes...
    – kokbira
    Aug 22, 2012 at 19:31
3

Use quotes like this:

start "" "Y:\foo bar\xyz"

If the first argument is quoted, start assumes it's the title for the new console window, so launch a new console window. The following argument will then be correctly interpreted as the command to run / file to open.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .