Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start 2 programs simultaneously in windows command prompt

I am using Windows 7 64bit

Here is the code snippet I am using to start

@echo off
call "C:\Program Files (x86)\LOLReplay\LOLRecorder.exe"
call "G:\League of Legends\lol.launcher.exe"
exit

But unless I close LOLRecorder.exe it won't start my lol.launcher.exe.... basically I want both running and the cmd prompt exit after they start. Whats wrong here? I checked out another stackoverflow answer Here but it refers to the same method I am using.

EDIT:

With the start command it just starts 2 terminal windows and nothing starts!

@echo off
start "C:\Program Files (x86)\LOLReplay\LOLRecorder.exe"
start "G:\League of Legends\lol.launcher.exe"
exit
like image 365
footy Avatar asked Jun 27 '11 01:06

footy


People also ask

How do I run multiple programs in command prompt?

Try using the conditional execution & or the && between each command either with a copy and paste into the cmd.exe window or in a batch file. Additionally, you can use the double pipe || symbols instead to only run the next command if the previous command failed.

Can you run 2 command prompts at once?

Click Start, type cmd, and press Enter to open a command prompt window. In the Windows taskbar, right-click the command prompt window icon and select Command Prompt. A second command prompt window is opened.

How do I open two programs at the same time?

To open a second window of certain open apps, just hold Shift and click on the icon in your taskbar. For programs like Word, Notepad, File Explorer, and Chrome, this will open a second window with a blank document. You can work in that instance of the app separately from whatever else you already have open.

How do I open two programs in Windows?

On the taskbar, select the Task view icon, then select New desktop. Open the apps you want to use on that desktop and then when you want to switch to a different desktop, select Task view again.


1 Answers

With the start command it just starts 2 terminal windows and nothing starts!

The problem is the quotes (which are unfortunately required, due to the spaces in the paths). The start command doesn't seem to like them.

You can work around this by using the short DOS names for all the directories (and remove quotes), or by specifying the directory separately and quoting it (which the start command seems to be able to deal with).

Try this:

@echo off
start /d "C:\Program Files (x86)\LOLReplay" LOLRecorder.exe
start /d "G:\League of Legends" lol.launcher.exe

Or, if your batch files become more complicated in the future, or your program names have spaces in them, this:

@ECHO OFF

CALL :MainScript
GOTO :EOF

:MainScript
  CALL :RunProgramAsync "C:\Program Files (x86)\LOLReplay\LOLRecorder.exe"
  CALL :RunProgramAsync "G:\League of Legends\lol.launcher.exe"
GOTO :EOF

:RunProgramAsync
  REM ~sI expands the variable to contain short DOS names only
  start %~s1
GOTO :EOF
like image 142
Merlyn Morgan-Graham Avatar answered Oct 13 '22 10:10

Merlyn Morgan-Graham