|Launch Condition: Z: Available?|
If your msi needs to access a specific drive (Z: in this case), then the simplest way of displaying a suitable error message is to customise the default error message that Windows Installer will display (for the error 1327) to be more user-friendly:
;--- Machine must have a Z: --- <$Table "Error"> <$Row Error="1327" Message=^Drive "" does not exist. This is required to install this product.^> <$/Table>
|Overriding from Command Line|
If required you should be able to override the appropriate directory key from the "MSIEXEC.EXE" command line. If you used the "DirectoryTree" command to define a directory "off the root" like this:
<$DirectoryTree Key="INSTALLDIR" Dir="K:\SomeSubDir" CHANGE="\" PrimaryFolder="Y">
Then the name of the root drive/directory is contained in a public property named with the value of the macro "DIRTREE_DRIVE_PROPERTY_PREFIX" followed by the drive letter, with the default value this would be "DRIVE.K" for the above definition.
msiexec.exe /i SomeMsi.msi /l*v SomeLog.txt DRIVE.K="S:\">
|Use Actions to Verify or Alter Directory|
You can use a custom action to see if the drive exists and take appropriate action (display an error message or default to another location before Windows Installer validates it).
This demonstrates one way the value can be overriden (could be reading an environment variable's value and could be conditionally executed):
#( <$PropertyCa "<$DIRTREE_DRIVE_PROPERTY_PREFIX>K" ;;Update the root key Value="c:\TMP\AAAA\" ;;This is the new "root" (any directory name) Seq="1-" SeqTable=^InstallUISequence InstallExecuteSequence^ ;;Do this before Windows Installer validates the value > #)