Subscribe to Windows IT Pro
January 09, 2000 12:00 AM

How do I call a batch file from within another batch file?

Windows IT Pro
InstantDoc ID #13445
Rating: (138)

A. Simply entering a batch file’s name within another batch file will run the batch file you want to call. However, after the called batch file completes, it won’t pass control back to the calling batch file. Thus, the calling batch file will be incomplete. To call a batch file and have the file return to the calling batch file after the called file completes, use the call command.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Jul 13, 2005

    Unless you batch file exists in one of your PATH variables, you need to provide to full path to the file.

  • Anonymous User
    7 years ago
    May 05, 2005

    While calling a batch file from a file by using the call statement in the following way
    call bat1.bat
    call bat2.bat

    But it gives an error like "bat2.bat" is not an interanl or external command or program or batch file.
    There is no path problem

  • gourav verma
    9 years ago
    Nov 13, 2003

    i want to know how to execute a file(which has a sql command) from query analyzer
    main problem is
    1 a batch file which has following command
    (osql -S server -U sa -P sa < C:\\SCRIPT.SQL > C:\\Result.txt)

    2 script.sql has the name of files
    CreateTable.sql
    CreateProcedure.sql

    3 above given 2 files have script to create the tables & procedure respectivly


    so please tell me how i can do it

    thanking tou

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.