Is there a way to create a Global Variable for Multiple .Bat Files?

Discussion in 'other software & services' started by letgetcc, Dec 13, 2009.

Thread Status:
Not open for further replies.
  1. letgetcc

    letgetcc Registered Member

    Joined:
    Jul 6, 2008
    Posts:
    8
    Example:
    Start.Bat Contains:
    "D:
    CD\MyWorkingFiles
    MyProgram.exe"


    Instead of using D: in the Start.Bat, can we use something like
    SetGlobalVariable => D:\GlobalVariable.ini (Inside this file is simple "E:")

    Example2:
    Start.Bat Contains:
    "SetGlobalVariable => D:\GlobalVariable.ini
    %GlobalVariable%
    CD\MyWorkingFIles
    MyProgram.exe"



    This way, let's say I had 100 .BAT Files, instead of changing all .BAT files from D: to E:, I would just have to change D:\GlobalVariable.ini from D: to E:

    Is this possible?
     
  2. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Yes, create an environment variable. For instance, when you use %systemdrive% it is referring to the c: (usually). This is an environment variable that can be called in any batch script. Just create what you need.

    Sul.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.