How do I run a program in a Windows batch file without waiting for the program to exit? I can't get current...
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 |
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 '18 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 '18 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 '18 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 '18 at 19:23
add a comment |
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 '18 at 18:08
user2023861user2023861
3,77142841
3,77142841
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 '18 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 '18 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 '18 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 '18 at 19:23
add a comment |
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 '18 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 '18 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 '18 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 '18 at 19:23
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 '18 at 18:28
Have you addressed the space issue first? stackoverflow.com/questions/18537098/…
– wannadream
Nov 19 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 19:23
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
0
active
oldest
votes
0
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 '18 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 '18 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 '18 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 '18 at 19:23