Unable to add %APPDATA% to the path
I would like to be able to add "%APPDATA%\AFolder" to the %PATH%.
This is so that whoever logs on to the computer will have a path statement with
;C:\Documents and Settings\user1\Application Data\AFolder
I am adding it using the Environment table within an MSI. See below for Environment table entry.
=== Environment Table ===
Environment Name Value Component_
PATH *=-PATH [~];%APPDATA%\AFolder Environment
The result is that the Path environment variable is not expanding the %APPDATA% variable.
I get:
C:\ >set PATH
PATH=%APPDATA%\AFolder
Instead of:
C:\ >set PATH
PATH="C:\Documents and Settings\user1\Application Data\AFolder"
This behaviour is described as a bug in shell32.dll (for over two years!!) here: http://support.microsoft.com/kb/329308 and here:http://windowsitpro.com/article/articleid/77604/jsi-tip-6300-appdata-environment-variable-does-not-expand-when-added-to-the-path.html and both describe the same workaround which is to set the path manually using the Manage Computer GUI.
I need to know if there is a way to this programmatically so I can create a custom action in the MSI to bypass the bug.
Many thanks,
Daz
Comments
You may tryPATH
You may try
PATH *=-PATH [~];[%APPDATA]\AFolder
or use the path as you can see in the directory table entry
[~];%APPDATA%\AFolder is not
[~];%APPDATA%\AFolder is not correct syntax within an MSI - it looks like you are trying to use Wisescript formatting here.
Instead, use [~];[%APPDATA]\AFolder in your MSI.
The topic "Formatted" in MSI.CHM will give you all the possible formatting methods available for MSI files, but basically to insert an environment variable into a path, you use the syntax [%Env_Var]
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Stop!
AppData has no business being in the path! It's designed for DATA not executables. What sort of brain-dead app is this? Oh, wait...is it from IBM or CA?
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
[delayed response]
Excellent deduction: Answer: IBM - The app is Lotus Notes 7.0.4 client.
When notes starts, the first thing it does is it looks in all folders in the path for a Notes.ini file. From there, the application finds out where the user's 'local' Notes data folder is and everything else based on the first Notes.ini it finds. The application itself is not in the %APPDATA% subfolder I want to use.
The default location that this application uses is, outrageously, %ProgramFiles%\lotus\notes\data. The department I am packaging this for do not want to use a network drive, so I am using the users profile so at least other standard users can't access it as the user's personal name and address book is also kept in the 'local' Notes data dir.
Now, I can amend the app shortcut to add a parameter to point directly to the correct folder without using the path, or even change the working folder of the shortcut to %APPDATA%\NotesData do that it looks in there first. But if (I hate Notes) Notes is not running, and you want to right-click sendTo a file, Notes fires up and looks in the Path again for a Notes.Ini. And the Email shortcut at the top of the start menu would need to be amended in the registry. SO basically I would end up changing every registry key responsible for calling Notes to change the calling command line OR I can find a way to amend the %PATH%.
Regards,
Daz.
Darren Collins
Applications Packaging and Deployment for the ICT Support Team,
Oxford University, UK.
The voice of logic and reason
Yup, a salient point well made.
Unfortunately, not all developers have been whipped sufficiently to avoid making these stupid errors in placing code where only data should go....
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Let's be honest...
...in 2009, apps have no business using PATH, period. If you're too stupid to use the relevant API to find out where your app has run from, find alternative employment. Jeez...
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
Would you like to reply?
Login or Register to post your comment.