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.
     
Loading...
Thread Status:
Not open for further replies.