Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put Install path in Registry

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hi
Is it possible to access the Install Path a user selects when running my install so I can put that path in the registry?

Thanks
 
I assume you are using a Visual Studio Install Project.

All you do is go to the Registry Editor, select where you want to create the registry setting and then place [TAGRETDIR] in the Value property.
 
Thanks for the post. I found that some where else also. All works perfectly now. Do you know of a way to get the exe name as well? I searched google but I did not find anything.
 
I am not aware of anyway to get the exe name, but as the user can not change it, I don't see why it would be an issue to hard code it.
 
They can rename the exe once its installed on their box and my code will look for a specific exe name.
 
If you store the .exe name in the registry at install time and after install the user changes the name, your system will break whether you got the name correct or not.

Are you trying to find the executable from inside a running instance of it? If so you may want to take a look at this function.

Code:
System.Reflection.Assembly.GetExecutingAssembly().Location
 
What i am doing is allowing a user to upload a file via a web form. when the upload is complete, I kick off a batch process. I need to hard code the name of the executable inside my webform. If i change the name of the exe, I need to make reference the change in my web form. My hope of putting the exe path in the registry was to save me from having to edit the web form. More of a convenience that anything else, but your above mentioned reference will be valuable in the future.

Thanks.
 
So the person installing the exe will not be able to change the name until after the install has run, so it is safe to hard code the exe name into the install. If they change the name of the exe after the install they will have to change the registry setting by hand because the install has long since finished. It is not very likly that someone will change the exe name anyway.

Just create a registry entry using the install wizard and give it a value like this:

[TARGETDIR]\WhatICalledTheExe.exe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top