15

I'm attempting to execute a batch script that currently looks like this:

D: cd D:My Documents\FtpSolution\Test getftp.bat call delimconvert.exe call convert-to-xls.bat 

However this stops dead after getftp.bat has run.

What am I doing wrong? It's important that these commands all run sequentially.

3 Answers 3

39

Use call:

Calls one batch program from another. CALL [drive:][path]filename [batch-parameters] batch-parameters Specifies any command-line information required by the batch program. 

If you invoke other batch files without call then control is passed to them but not back again (which is what call changes).

Sign up to request clarification or add additional context in comments.

1 Comment

If the called batch file invokes another batch file, this will not help.
2

use start command to launch it in a new window.

start /wait getftp.bat

1 Comment

Does this require 'exit' to be at the end of the other batch scripts? Currently once the first script has finished in the new window it just sits there at the prompt.
1

Try using "Goto :EOF" rather than "exit" at the end of the batch file that you're calling - in your case, the getftp.bat file... That's what fixed mine - tested on Win10 enterprise.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.