DJ Quimby
DJ Quimby

Reputation: 3699

Delphi Path Variables

In the Delphi IDE, the path to the Delphi installation is specified as $(DELPHI). I am wondering if there is a way to create my own path indicators, such as $(MY_LIBRARY) or something similar. I thought $(DELPHI) was specified as an environment variable, but apparently not. Any ideas? (I'm using Delphi 7)

Upvotes: 9

Views: 8927

Answers (6)

Byte Player
Byte Player

Reputation: 57

There is an alternative workaround -- use SUBST to assign a virtual drive letter to the root of the folder you would be using $(MyFiles) if you could and then just use that.

For Example if you have files in deep directory, you'd go to the command prompt and type:

SUBST M: "C:\users\Me\Delphi Files\My Components"

and then you could refer to it by M:

Upvotes: 0

Mohammed Nasman
Mohammed Nasman

Reputation: 11070

For Delphi 5 you can add them from windows Environment variables

right click on My computer > properties > advanced > Environment variables

Upvotes: 1

Brian Frost
Brian Frost

Reputation: 13454

In Windows 7 (and Vista is similar) click the 'start' button, right-click 'computer', 'properties' and then 'advanced system settings'. Click 'Environment variables' and you're now able to create new ones as global (system), or just for the current user (you). For example 'MyVar'.

Now in a delphi path, refer to MyVar as $(MyVar).

MyVar will now be visible in batch files too as %MyVar%.

Upvotes: 0

skamradt
skamradt

Reputation: 15548

Also of note is when your using the command line compiler, the file RSVARS.BAT located in the BIN directory of the current Delphi installation is what creates some of the environment variables for child processes. (for example BDS and BDSCOMMONDIR).

Upvotes: 0

Ken Bourassa
Ken Bourassa

Reputation: 6502

In Delphi 2010: I know many of the XML tags in the Project.dproj can be used like this. (For exemple, $(DCC_DcuOutput), $(DCC_ExeOutput)...).

Maybe it is possible to add your own XML tags in the file and use them afterward. Though I'm not sure if they'll be preserved by the IDE.

Upvotes: 0

da-soft
da-soft

Reputation: 7750

In Delphi 2010:

  • select Tools -> Options
  • select "Environment Variables"
  • specify either System, either User variable

Upvotes: 10

Related Questions