Posts

Showing posts from October, 2017

Call vs Start: Reasons why your batch script might not be writing output to file

Image
If you are calling another batch script from your source script you need to call it by preceding keywords Call or Start before the script name. But here also there is a catch: Start will open a new cmd window and execute command there and will not write the output in external text file if you have redirected it there: For example if you execute BatchScriptSource.bat it will not write anything in SomeTextFile.txt although it will be created. Contents of BatchScriptSource.bat start BatchScript.bat >> SomeTextFile.txt Contents of BatchScript.bat tasklist  Output Using Start: On the other hand Call will execute BatchScript.bat in the scope of same cmd session/window where BatchScriptSource.bat is being executed and will execute commands sequentially and write the output in SomeTextFile.txt as expected. Contents of BatchScriptSource.bat call BatchScript.bat >> SomeTextFile.txt Contents of BatchScript.bat tasklist Output Using Call: