|
![]() |
| The "Directory" Command |
This command creates a directory entry
entry in the MSI "Directory" table
.
It basically creates a single directory at a time given the name of a
parent.
It can also be given a full directory name in which case it will assign
it via a custom action.
Generally a better way of defining directories is via the
DirectoryTree command.
The macro takes these parameters:
If the "Key" was supplied in all upper case then the actual directory can be overriden on the MSIEXEC.EXE command line.
There are some standard folder keys which you can use, see Microsoft's MSI "System Folder Properties"
for more information.
The default for this parameter can be set via the DEFAULT_DIR1_PARENT macro. The initial value is "ProgramFilesFolder".
Unless the value contains "|" MAKEMSI normally adjusts the value so that there is a short/long name pair to prevent this set the "ASIS" parameter to "Y".
Note that the directory key must be specified in the "CreateFolder" table
table otherwise you should get validation errors and it won't work.
Delaying it's creation only makes sense if you are doing so in a "common header file", otherwise you already know whether you need it or not!
The "COMPANY.MMH" header uses "Y" to define system directories such as "ProgramFilesFolder" as "conditional".
Its best not to define directories that are not required as its easier to understand the msi and can also reduce the chance of installation issues since all directories are validated (whether used or not) during the install (some of these may be invalid on a "flakey" box).
Please note that this command doesn't validate parameters so if you mis-spell one it won't tell you... Sorry...
| EXAMPLES |
<$Directory KEY="AAA" PARENT="ProgramFilesFolder" DIR="AAA"> <$Directory KEY="BBB" PARENT="AAA" DIR="BBB"> <$Directory Key="DIR83" PARENT="AAA" DIR="AN83NAME.1|ALongDirectoryNameForWhichIHaveSuppliedASpecific_8.3_Name"> <$Directory KEY="ZDRIVE_CCC" VALUE="Z:\CCC">
| EXAMPLE - Create Alias to another directory |
The following shows one way to create an alias to another directory
(in this case a "system folder
"):
<$Directory KEY="INSTALLDIR" PARENT="ProgramFilesFolder" DIR="." ASIS="Y" CHANGE=".">
| EXAMPLE - Conditional Definition |
The following demonstrates how to define a "Diagnostics" start menu folder so it gets created if required:
;--- Conditionally define the "Start->Programs->Diagnostics" menu (defined on demand) ---
<$Directory Key="SCDIR_DIAGNOSTICS" Conditional="@@SCDIR_DIAGNOSTICS">
#(
;--- Define how to create the "standard" diagnostics folder -------------
#define @@SCDIR_DIAGNOSTICS
<$Component "SCDIR_DIAGNOSTICS" Create="Y" Directory_="<$AnyDir>" LM="Y">
<$DirectoryTree Key="SCDIR_DIAGNOSTICS" Dir="[ProgramMenuFolder]\Diagnostics" MAKE="Y" REMOVE="Y">
<$/Component>
#)
The above code will only get created when the directory key "SCDIR_DIAGNOSTICS" is first used.
![]() | ![]() |