Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many bat files that share a common setup of variables. Instead of defining the same variables over and over again (and making errors in the process) I would like to include one bat file in all the others.

How do I do this? Excuse my newbie question but the last time I touched bat, it was a file called autoexec.bat, long ago...


share|improve this question
up vote 6 down vote accepted

You can call another bat file with "call FILENAME". Don't really know if that is sufficient for you.

share|improve this answer
Thanks! Easy as that... – raoulsson Aug 26 '09 at 13:12
sometimes it is just that :) – StampedeXV Aug 26 '09 at 13:19
Do variables exist to the new batch file? I think you'll need to pass them to the environment with the SET Command. – BillN Aug 26 '09 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.