hi guys..

i have a registry value i'm trying to place in my project.. a path variable.. but it wont accept the usual "c:\program files\myapp" when i actually run my application.. i have to change it to "c:\progra~1\myapp" for it to function correctly.. how do i do this in my current project so when it installs it writes "c:\progra~1\myapp" instead of the full path? i'm using wps

thanks in advance.. =)

rick
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Hi,

The only solution I can think is (assuming you are delivering a file in your package to the path you need in the registry) to use the component path for the file. By using a ! prefix it will use the full short path to the location of the component - the actual file name is not included inthe path.

example:

[!myappexe.exe]


Graham
Answered 05/21/2005 by: GB1
Orange Belt

Please log in to comment
0
I think you may find that this information is slightly incorrect Graham?

Using the "!" character only works on the file key to my knowledge - not the component key (although these may often be the same). Using the file key may return a short path (assuming the tables have been populated correctly), but it will also return the file name on the end.

You may require a CA to accomplish what you're trying to do.

By the way, what do you mean by "path variable"? I'm assuming this is a simple registry key despite this ambiguous use of terminology?
Answered 05/21/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
The way I have done it in the past is to use [ROOTDRIVE]

So put in [ROOTDRIVE]Progra~1\Appname

Wise will accept this without changing it to long filename format.
Answered 05/21/2005 by: MSIMaker
Second Degree Black Belt

Please log in to comment
0
ORIGINAL: WiseUser

I think you may find that this information is slightly incorrect Graham?

Using the "!" character only works on the file key to my knowledge - not the component key (although these may often be the same). Using the file key may return a short path (assuming the tables have been populated correctly), but it will also return the file name on the end.

You may require a CA to accomplish what you're trying to do.

By the way, what do you mean by "path variable"? I'm assuming this is a simple registry key despite this ambiguous use of terminology?




Fair enough, your version sounds better - sorry, I was working from memory.

I assumed that it was soemthing he wanted to keep as a variable though. Like you say you might need a bit of script to sort this one out.
Answered 05/22/2005 by: GB1
Orange Belt

Please log in to comment
0
I wouldn't recommend using the ROOTDRIVE property, as this may not resolve to the drive where program files resides - you might end up with "D:\Progra~1\AppName" in the registry.

Besides, it's not good practice to hard-code paths. If someone decides to change the value of INSTALLDIR, the application should still work - it won't if you hard code things.

I'm pretty sure that a CA is the only good option.
Answered 05/22/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
ORIGINAL: WiseUser

I wouldn't recommend using the ROOTDRIVE property, as this may not resolve to the drive where program files resides - you might end up with "D:\Progra~1\AppName" in the registry.

Besides, it's not good practice to hard-code paths. If someone decides to change the value of INSTALLDIR, the application should still work - it won't if you hard code things.

I'm pretty sure that a CA is the only good option.






For what it's worth I agree with quote above and appologise again for my duff info - next time I post I will double check my info.

I had confused prefixes you CAN use with filekeys and those you cant with components. Even with the file key it will include the filename as WiseUser correctly said.

For reference the stuff I talking about is here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/formatted.asp
Answered 05/22/2005 by: GB1
Orange Belt

Please log in to comment
0
ORIGINAL: WiseUser
I wouldn't recommend using the ROOTDRIVE property, as this may not resolve to the drive where program files resides - you might end up with "D:\Progra~1\AppName" in the registry.

Besides, it's not good practice to hard-code paths. If someone decides to change the value of INSTALLDIR, the application should still work - it won't if you hard code things.

I'm pretty sure that a CA is the only good option.


While I agree that you shouldnt hard code paths...he did ask for C:\Program Files and so I'm assuming his app will never see a server.

btw if he is running multiple partition machines and he doesnt have ROOTDRIVE set then he will one day end up with apps on the other drives anyway, once C: starts to fills up.
Answered 05/22/2005 by: MSIMaker
Second Degree Black Belt

Please log in to comment
0
Hi Jim,

I'm only quoting best practise - what Rixk2 finally does is up to him. Depending on his personal situation, "best practise" may not be the best way forhim to proceed. Creating a CA to solve this issue correctly without hard-coding anything might be overkill if he knows that the INSTALLDIR will never change in his envionment. However, using "ROOTDRIVE" would be worse than hard-coding the path because it may resolve to a totally different drive.

The "ROOTDRIVE" property will not affect which drive packages are installed to if they are installed under "ProgramFilesFolder" - only if they are installed to a root folder. So in this particular case, the application will always go to drive "C".

And may I be the first to congratulate you on 500 posts!!
Answered 05/23/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
hi guys.. sorry for this very late reply. i have been called away to work on another project (repackage another application =)

here's another thing that came up and is very connected with my original post..

how do i append my program directory to the value of Path in the Environment Variables and write it out like this
"existingpaths;c:\myprog~1;c:\myprog~2"

my path usually ends like this
"existingpaths;c:\myprogam directory1;c:\myprogam directory2"

i'm thinking of using vbscript for this but i wont till i get some feedbacks from you guys =)

thanks very much for the replies.. i really appreciate the help, feedbacks and suggestions

rick =)
Answered 05/25/2005 by: rikx2
Purple Belt

Please log in to comment
0
btw.. c:\myprogra~1 and c:\myprogra~2 is actually [INSTALLDIR] and so.. i'm not placing hardcoded directories on my project.. =)

thanks again
rik
Answered 05/25/2005 by: rikx2
Purple Belt

Please log in to comment
0
Use the "Environment" table.

Add a new row as follows:

Environment column: "Path"
Name column: "*=-Path"
Value column: "[~];[INSTALLDIR]"

Remove the quotes of course.[;)]

For details, read the SDK at the following location:

http://msdn.microsoft.com/library/en-us/msi/setup/environment_table.asp
Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
ORIGINAL: WiseUser

Use the "Environment" table.

Add a new row as follows:

Environment column: "Path"
Name column: "*=-Path"
Value column: "[~];[INSTALLDIR]"

Remove the quotes of course.[;)]

For details, read the SDK at the following location:

http://msdn.microsoft.com/library/en-us/msi/setup/environment_table.asp



Hi WiseUser,

Maybe you can assit me with your advice above too.

I have sucessfully used the [~] to apend to envrionment variables (well the PATH specifically) before. However, according to

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/registry_table.asp

you can also use the [~] in a registry value. My understanding is if you preceed a string value with [~] it will append the string value to the end of the exisiting string value. However I have never made this work in practice - the result if I remember correctly is the value is deleted all together!

Have you ever tried this with a good result?
Answered 05/25/2005 by: GB1
Orange Belt

Please log in to comment
0
If you're thinking what I'm thinking you're thinking - be careful!!

The "Path" environment variable is a registry key, but it must be of type "REG_EXPAND_SZ" in order to work correctly.

If you try writing to this key using the registry table as you appear to be suggesting, you might accidentally change the type.
Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
ORIGINAL: WiseUser

If you're thinking what I'm thinking you're thinking - be careful!!

The "Path" environment variable is a registry key, but it must be of type "REG_EXPAND_SZ" in order to work correctly.

If you try writing to this key using the registry table as you appear to be suggesting, you might accidentally change the type.



No, I wasn't thinking of writing to the path via the registry, it was a different question altough related to your response I quoted, in terms of using [~] to append.

It seems to be documented (see my link above), but I have never made it work and wondered if it was just me.

My quick fix was to use a system search and use the property as a way of appending a registry value in my MSI. Both my work around and the use use of the [~] (if it does work) suffer from the downside neither checks to see if the value already exists in the string however.

In short am I correct in saying that appending a registry value, only with a value that doesn't already exisit in the value string, requires a custom action?
Answered 05/25/2005 by: GB1
Orange Belt

Please log in to comment
0
Btw, I think what you have experienced in the past can be explained as follows.

The existing key is of type "REG_SZ". Your new key is considered to be of type "REG_MULTI_SZ". Because they're not the same type, the "REG_SZ" key is overwritten with the new "REG_MULTI_SZ" one.

If the original key had been a "multi string" one, the value would have been appended.

Hope this makes sense?[:D]
Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
Unless the registry in question happens to represent an environment variable, or is of type "REG_MULTI_SZ", I guess the short answer must be "yes".
Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
hi guys.. thanks for the replies..
i have no problem appending to the existing path variable.. but what i was trying to do is instead of appending the full path of my app directory "c:\program files\myapp" it should append as "c:\progra~1\myapp"


thanks very much... you guys are great =)

rick
Answered 05/25/2005 by: rikx2
Purple Belt

Please log in to comment
0
ORIGINAL: WiseUser

And may I be the first to congratulate you on 500 posts!!



Thanks alot...I hadnt noticed myself.....500 posts came around pretty quickly . I better get back to work before my boss finds out :)

btw...let me pass my congrats to you as well for 200 posts...wd and thanks for all the help.
Answered 05/26/2005 by: MSIMaker
Second Degree Black Belt

Please log in to comment
0
Hi rikx2,

Remember.. Everything you cant do in MSI, you can script yourself out of... I have had the same problem with Notes, so what i did was making an embedded VBscript in the "execute immidiate" sequece, witch converted the property [INSTALLDIR] (C:\Program Files\Lotus\Notes) to a 16 bit Value string (C:\Progra~1\Lotus\Notes) and wrote the new value to the registry... I dont have the script now.. but hope it can lead u in the right direction.
Answered 05/27/2005 by: MMA
Senior Yellow Belt

Please log in to comment
0

I just realized that I am replying back to a very old post but perhaps someone will still be able to help.
I would like to append to a registy key //HKey_LocalMachine/software/microsoft/windows/currentversion
the key is called DevicePath, I would like to append to it and remove it if the program is uninstalled.
I have tried the methods mentioned in your posts regarding placing a tilde in the a registry value from 5/2005 but have not had luck.
Environment variable doesn't work because the key I am referring to is = not an environment variable and I am not having luck using the tilde and registy entry but perhaps I am not doing it correctly.
in my wsi I have 15 files getting copied locally and one registry entry
Currently I have the path and key name under destination computer and my key value is set to: [~];%systemdrive%\PnPdrvers\Merlin
All this seems to do is add a key under Hkey Current User/Environment
Any thoughts or advice would be great.
Thanks!
Answered 01/03/2008 by: Deployee
Yellow Belt

Please log in to comment
0
Hi rikx2,

Tama si MMA, kung hindi mo magawa sa ordinaryong Custom Action (may condition) or Property Value. Mas magandang gawin mo nalang sa vbscript, dyan ka naman malupit eh.

knight [8D]
Answered 01/03/2008 by: knight
Orange Senior Belt

Please log in to comment
0
Currently I have the path and key name under destination computer and my key value is set to: [~];%systemdrive%\PnPdrvers\Merlin
All this seems to do is add a key under Hkey Current User/Environment
You have the correct format for appending to a registry value. Something somewhere is pointing to the wrong key. Run your MSI with verbose logging: that should highlight what's going wrong.
Answered 01/04/2008 by: VBScab
Red Belt

Please log in to comment
0
Tama si MMA, kung hindi mo magawa sa ordinaryong Custom Action (may condition) or Property Value. Mas magandang gawin mo nalang sa vbscript, dyan ka naman malupit eh.With the greatest respect, if this is a response with a solution, it would be of universal use for it to be in English, as this is (self-evidently) a predominantly English forum. If it's a private message, maybe a PM/email would have served better?
Answered 01/04/2008 by: VBScab
Red Belt

Please log in to comment
0
I just realized that I am replying back to a very old post but perhaps someone will still be able to help.
I would like to append to a registy key //HKey_LocalMachine/software/microsoft/windows/currentversion
the key is called DevicePath, I would like to append to it and remove it if the program is uninstalled.
I have tried the methods mentioned in your posts regarding placing a tilde in the a registry value from 5/2005 but have not had luck.
Environment variable doesn't work because the key I am referring to is = not an environment variable and I am not having luck using the tilde and registy entry but perhaps I am not doing it correctly.
in my wsi I have 15 files getting copied locally and one registry entry
Currently I have the path and key name under destination computer and my key value is set to: [~];%systemdrive%\PnPdrvers\Merlin
All this seems to do is add a key under Hkey Current User/Environment
Any thoughts or advice would be great.
Thanks!


I would want to use a vbscript in a Custom Action in the Execute Deferred table. The problem you will run into is not so much appending the value, but more so to remove it on uninstall, since you do not know what else might modify this key between your install and uninstall. Create a VBScript to read the value, append your value, and write it back on install. Then create a seperate VBScript to read the value, parse the string, remove your entry, and write the updated string back on uninstall.
Answered 01/04/2008 by: xythex
Orange Senior Belt

Please log in to comment
Answer this question or Comment on this question for clarity