How do I run a program in a Windows batch file without waiting for the program to exit? I can't get current...
up vote
1
down vote
favorite
I'm trying to create a batch file that opens Visual Studio Code. I'm using this SO answer as a guide to do so. This is the command I end up with:
start "MyTitle" "C:Program FilesMicrosoft VS Codebincode.cmd" "C:MyFolder"
When I run this, I see two command windows appear:
- One window runs the command and closes immediately. I think this is right.
- The other window is titled "MyTitle" and gives me this error message:
- 'C:Program' is not recognized as an internal or external command,
operable program or batch file.
- 'C:Program' is not recognized as an internal or external command,
What am I doing wrong? Do I need to escape the spaces in that path?
I've found a lot of SO questions relating to this, and I've tried the solutions I've found, but I can't get anything to work. Here are some answers I've found and tried:
- Opening/Closing application via .bat file [Windows]
- Run a Program and exit the cmd window
- Windows batch file, wait for command to finish?
- How can I run a program from a batch file without leaving the console open after the program starts?
windows batch-file
add a comment |
up vote
1
down vote
favorite
I'm trying to create a batch file that opens Visual Studio Code. I'm using this SO answer as a guide to do so. This is the command I end up with:
start "MyTitle" "C:Program FilesMicrosoft VS Codebincode.cmd" "C:MyFolder"
When I run this, I see two command windows appear:
- One window runs the command and closes immediately. I think this is right.
- The other window is titled "MyTitle" and gives me this error message:
- 'C:Program' is not recognized as an internal or external command,
operable program or batch file.
- 'C:Program' is not recognized as an internal or external command,
What am I doing wrong? Do I need to escape the spaces in that path?
I've found a lot of SO questions relating to this, and I've tried the solutions I've found, but I can't get anything to work. Here are some answers I've found and tried:
- Opening/Closing application via .bat file [Windows]
- Run a Program and exit the cmd window
- Windows batch file, wait for command to finish?
- How can I run a program from a batch file without leaving the console open after the program starts?
windows batch-file
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
2
The batch file"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe"C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.
– LotPings
Nov 19 at 18:33
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command isstart "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm trying to create a batch file that opens Visual Studio Code. I'm using this SO answer as a guide to do so. This is the command I end up with:
start "MyTitle" "C:Program FilesMicrosoft VS Codebincode.cmd" "C:MyFolder"
When I run this, I see two command windows appear:
- One window runs the command and closes immediately. I think this is right.
- The other window is titled "MyTitle" and gives me this error message:
- 'C:Program' is not recognized as an internal or external command,
operable program or batch file.
- 'C:Program' is not recognized as an internal or external command,
What am I doing wrong? Do I need to escape the spaces in that path?
I've found a lot of SO questions relating to this, and I've tried the solutions I've found, but I can't get anything to work. Here are some answers I've found and tried:
- Opening/Closing application via .bat file [Windows]
- Run a Program and exit the cmd window
- Windows batch file, wait for command to finish?
- How can I run a program from a batch file without leaving the console open after the program starts?
windows batch-file
I'm trying to create a batch file that opens Visual Studio Code. I'm using this SO answer as a guide to do so. This is the command I end up with:
start "MyTitle" "C:Program FilesMicrosoft VS Codebincode.cmd" "C:MyFolder"
When I run this, I see two command windows appear:
- One window runs the command and closes immediately. I think this is right.
- The other window is titled "MyTitle" and gives me this error message:
- 'C:Program' is not recognized as an internal or external command,
operable program or batch file.
- 'C:Program' is not recognized as an internal or external command,
What am I doing wrong? Do I need to escape the spaces in that path?
I've found a lot of SO questions relating to this, and I've tried the solutions I've found, but I can't get anything to work. Here are some answers I've found and tried:
- Opening/Closing application via .bat file [Windows]
- Run a Program and exit the cmd window
- Windows batch file, wait for command to finish?
- How can I run a program from a batch file without leaving the console open after the program starts?
windows batch-file
windows batch-file
asked Nov 19 at 18:08
user2023861
3,71642840
3,71642840
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
2
The batch file"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe"C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.
– LotPings
Nov 19 at 18:33
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command isstart "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23
add a comment |
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
2
The batch file"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe"C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.
– LotPings
Nov 19 at 18:33
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command isstart "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
2
2
The batch file
"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe "C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.– LotPings
Nov 19 at 18:33
The batch file
"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe "C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.– LotPings
Nov 19 at 18:33
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command is
start "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command is
start "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380368%2fhow-do-i-run-a-program-in-a-windows-batch-file-without-waiting-for-the-program-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 at 18:28
2
The batch file
"C:Program FilesMicrosoft VS Codebincode.cmd"
will spawn the .exe"C:Program FilesMicrosoft VS CodeCode.exe"
anyway and terminate, so simply call the batch to have it return to the batch afterwards.– LotPings
Nov 19 at 18:33
@wannadream I'm not using Powershell. If I can't get this batch script figured out, I'll switch to Powershell.
– user2023861
Nov 19 at 19:15
@LotPings That fixed it. I dind't think to look into the *.cmd file. Now my command is
start "MyTitle" "C:Program FilesMicrosoft VS CodeCode.exe" "C:MyFolder"
– user2023861
Nov 19 at 19:23