HOW TO EXIT, using the "start" in MSDOS batch files

I want to copy some files to different USB drives and want to use START to open several consoles as follows:

start copy a.txt h: start copy a.txt i: start copy a.txt j: 

But every time I run the batch file, there are 3 consoles without exit. How can I implement this EXIT function WITHOUT using 3 batch files and invocation commands:

copy.bat:

 call a.bat call b.bat call c.bat exit 

and three called batch files:

a.bat:

 start copy a.txt h: exit 

b.bat:

 start copy a.txt i: exit 

c.bat:

 start copy a.txt j: exit 

I already tried this, but it does NOT work:

 start copy a.txt h: && exit start copy a.txt i: && exit start copy a.txt j: && exit 
+6
source share
2 answers

You need to leave && so it becomes part of the command executed by the start, and not the parent batch file.

 start copy a.txt h: ^&^& exit 

To close the new console, even if there are errors, you can do:

 start "" "%comspec%" /c copy a.txt h: 
+13
source

You can use start to start a new cmd window and close it after running this command as follows:

 start cmd /c copy a.txt h: 
+4
source

Source: https://habr.com/ru/post/907301/


All Articles