This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Get short file name for a directory
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)
Anonymous
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2010
07:50 AM
Get short file name for a directory
Does anyone know a way to get the short file name of a directory (specifically INSTALLDIR) without using scripts?
This is for a Basic MSI.
Thanks.
This is for a Basic MSI.
Thanks.
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2010
11:24 AM
Take a look at the following Windows Installer documentation:
Formatted
http://msdn.microsoft.com/en-us/library/aa368609(v=VS.85).aspx
You can use [!filekey] syntax with a file key for a file that is set to be installed to INSTALLDIR. This will give you a short path including that file name. If you didn't want the file name as part of it, then you may need to use a custom action of some sort to strip out the file name part from the path.
-Ajay
Formatted
http://msdn.microsoft.com/en-us/library/aa368609(v=VS.85).aspx
You can use [!filekey] syntax with a file key for a file that is set to be installed to INSTALLDIR. This will give you a short path including that file name. If you didn't want the file name as part of it, then you may need to use a custom action of some sort to strip out the file name part from the path.
-Ajay
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)
Anonymous
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2010
02:54 PM
There is no file. Just a directory.
I tried setting my environment variable to [!INSTALLDIR], but it didn't work. It was just blank.
Would I use a CA to set a property? Like maybe NEWINSTALLDIR = [!INSTALLDIR]?
I tried setting my environment variable to [!INSTALLDIR], but it didn't work. It was just blank.
Would I use a CA to set a property? Like maybe NEWINSTALLDIR = [!INSTALLDIR]?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2010
02:56 PM
Hi,
You need to use a file key in [!filekey] to get a short path to the file. File keys can be found in the first column of the File table which you can see in the Direct Editor view. Note that INSTALLDIR is actually a directory key and not a file key.
You need to use a file key in [!filekey] to get a short path to the file. File keys can be found in the first column of the File table which you can see in the Direct Editor view. Note that INSTALLDIR is actually a directory key and not a file key.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)
Anonymous
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 18, 2010
03:40 PM
Oh I get it. Thanks so much!
What kind of CA should I use to strip the filename though?
What kind of CA should I use to strip the filename though?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 21, 2010
11:24 AM
The custom action to use will depend on your preferences. It may be easiest to use a vbscript custom action. Or you may want to go with a C++ MSI DLL or a C# DLL. The downsides of vbscript include, rarely, there is an issue with the Windows Scripting Host on a machine that prevents vbscript custom actions from running. Also, infrequently/rarely, there is an issue where an anti-virus software prevents vbscript custom actions from running. The downsides of C++/C# is that it is a bit harder to implement from scratch.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)