1

I have one batch file which runs multiple batch files. I use the CALL statement in this file. But after execution one batch file I have to press any key to run other batch file. Is there any posibility how to disable this condition to press any key after call every single batch?

P.S. I need "press any key" when I run single batch.

There is an example of the main batch file

 @echo off
 echo This batch runs all scripts
 CALL A.bat 
 CALL B.bat 
 CALL C.bat         
3georgo3
  • 95
  • 1
  • 14
  • remove the `pause` command. If there is none, show (relevant part of) your code. – Stephan Nov 03 '16 at 10:47
  • 1
    look into this post: http://stackoverflow.com/questions/4552648/suppress-the-press-any-key-to-continue-in-batch-script – Sandy Nov 03 '16 at 10:48
  • @Stephan I got this batch -> http://www.pastebin.com/63jgBHvU – 3georgo3 Nov 03 '16 at 12:36
  • that script won't give you "press any key". Take a look into the called scripts., – Stephan Nov 03 '16 at 12:38
  • I got pause in these batch files. But I need that pause when I run batches individually. But when I Run this batch, I don´t want to press a key. – 3georgo3 Nov 03 '16 at 12:43
  • Include your code into the question by [editing](http://stackoverflow.com/posts/40399475/edit) your post! Links may become invalid in future, and some users might not have access privileges to certain external resources... – aschipfl Nov 03 '16 at 13:31
  • Ok, no problem. – 3georgo3 Nov 03 '16 at 13:35

2 Answers2

8

you (probably) have a pause command in each of the called scripts. Remove them.

If you are not allowed to modify these scripts (or it doesn't make sense to modify them because they are created dynamically), you can fake an ENTER by piping an echo to the scripts:

echo/|call A.bat
echo/|call B.bat
echo/|call C.bat

echo/ will just output a CRLF (= ENTER = empty line)
| will give the output of the left command as input to the right command.

Note: this will give an ENTER to the first command in the scripts, that expect some input. If you're lucky, it's the pause command.

edit to match your recent comment to the question:

when you can edit your a.bat etc, you can replace the pause command there with this line:

echo %cmdcmdline%|find /i " CALL " >nul || pause

This checks, if the script was called and only executes the pause, when not.

%cmdcmdline% contains the exact way, how the script was being executed.

Stephan
  • 53,940
  • 10
  • 58
  • 91
-1

Use Pause>null to suppress the 'Press any key to continue.' message.

http://ss64.com/nt/pause.html

3rd Battalion
  • 25
  • 1
  • 7
Sir Alex
  • 1
  • 2