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.




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?










share|improve this question






















  • 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















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.




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?










share|improve this question






















  • 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













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.




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?










share|improve this question













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.




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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 is start "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






  • 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
















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

















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',
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
});


}
});














draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'