0

I followed the following

tutorial open program from cmd.exe

The command I used is: Start "dBox" "C:\Program Files (x86)\Dropbox\Client\Dropbox.exe"

I would expect to have a new cmd windows with title dBox which is gonna open my program... It does nothing, no message..

They suggest the same things on other website. Some suggest removing the " for the second parameter, however I have spaces in the path so it is not suggested...

I cannot see what I do wrong?

Community
  • 1
  • 1
Maxime Joyal
  • 183
  • 1
  • 12

2 Answers2

2

I would expect to have a new cmd windows with title dBox which is gonna open my program...

Next start command should do the task:

Start "dBox" cmd /K "C:\Program Files (x86)\Dropbox\Client\Dropbox.exe"

I do not have Dropbox.exe installed. Therefore I could suppose that it's either console or GUI application or a service. Let's substitute Dropbox.exe with typical executables of that type:

Console application (tasklist.exe):
tasklist.exe displays all running applications and services with their Process ID (PID) in new cmd windows of title dBox:

start "dBox" cmd /K "C:\Windows\System32\tasklist.exe"

GUI application (iexplore.exe):
new cmd windows has title dBox - "C:\Program Files\Internet Explorer\iexplore.exe" and Internet Explorer starts.

start "dBox" cmd /K "C:\Program Files\Internet Explorer\iexplore.exe"

Service: not tested yet; it would exceed original question topic.

JosefZ
  • 28,460
  • 5
  • 44
  • 83
1

If you specifically want a new cmd window with that specific title, from which your program is run, you may try the following:

start "dBox" cmd | "c:\program files (x86)\dropbox\client\dropbox.exe"

start "dBox" cmd | (start /d "c:\program files (x86)\dropbox\client" dropbox.exe)

I don't have DropBox installed, but this works for other executables, so it should work for you.

Walking through the code, what you want first of all is a new command window, and running the DropBox executable is subsequent to that, so let's at least see how to get a new cmd window with your title going: start "dBox" cmd

Now, how do we repeat that while also getting another executable to run from that window? This is where the "|" (pipe) symbol comes into play, which is for redirection. The documentation says that the output from the command on the left is piped into the command on the right. We want a new process started from a new cmd window, and the only way I've been able to get that to work (seemingly so, anyway) is by using start twice.

You can read more about redirection here.

Edit: The first command is crossed out because I realized it made the process a child of the original cmd window. The giveaway is that the original cmd window is unusable until the child process is killed. I can't confirm, at the moment, if the second command does the trick exactly as stated in the question.

Community
  • 1
  • 1
benJephunneh
  • 658
  • 10
  • 14
  • thx a lot for you answer! I realise that the the parameter /home is normally passed as parameters to the program. Can I open it this way? – Maxime Joyal May 19 '16 at 16:26
  • Please note the correction. As for parameters passed to dropbox.exe, start allows for their inclusion at the end of the command. I would try `...ox\client" dropbox.exe /home)` – benJephunneh May 19 '16 at 17:49
  • Your answer is **utterly wrong**. Please double check both [syntax-redirection](http://ss64.com/nt/syntax-redirection.html) and [start command](http://ss64.com/nt/start.html) articles. – JosefZ May 19 '16 at 18:38