How to change target folder automatically by script when installing

Context : I need to install (thru MSI) programs in a folder whose name is stored as data in the Registry.
I don't know this folder name when I create my MSI file.
Question : How can I change the target folder by reading the Registry before installing. I know how to access the Registry, but I don't know how to change the folder name using Customer Action.
As I don't know C programming, I would like to resolve this problem in VB Script (if possible).
MichelJalletAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lamaslanyCommented:
To confirm:

You have an MSI install package that accepts the target (destination) folder as a parameter.  You want to write a script that can read the target folder from a registry entry and run the installer with the target folder parameter?
0
MichelJalletAuthor Commented:
Yes it is.
0
lamaslanyCommented:
How familiar are you with vbscripts?  If you are comfortable using vbscripts I'd suggest looking at Microsoft's Script Center:

Registry (look at the "Read a..." samples)
http://www.microsoft.com/technet/scriptcenter/scripts/os/registry/default.mspx

Install Software on the Local Computer
http://www.microsoft.com/technet/scriptcenter/scripts/apps/user/usapvb03.mspx


0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

MichelJalletAuthor Commented:
I have no problem with VBScript nor with creating MSI file.
My problem is with MSI Customer Actions. I would like to write a Customer Action in VBScript to change target folder of the installation.
Installation is unattended... and the folder name is in a Registry entry.
0
lamaslanyCommented:
Sorry I don't know what "MSI Customer Actions" are.
0
lamaslanyCommented:
Wait - custom actions?  Are you trying to add a vbscript to an existing MSI?

Do you want the script to be executed to find the target folder THEN run the installer?

or

Do you want the installer to run the script as part of the install and use the target folder returned as a parameter for the installer?
0
MichelJalletAuthor Commented:
Sorry for Custom(er) Action.
That's the second point.
0
lamaslanyCommented:
I might have to let someone else pick this up then as I'm not familiar with Custom Actions in this context.  :(
0
Vadim RappCommented:
in your msi, do this:

1. create system search for your registry entry - row value; have the result returned into property INSTALLDIR

2. in the execute script, move action AppSearch after CostFinalize.
0
MichelJalletAuthor Commented:
Thanks for your comment.
I'll try this solution... even if I don't undestand clearly what to do (move action AppSearch after CostFinalize ?)
0
Vadim RappCommented:
> move action AppSearch after CostFinalize ?

The installation has a script, which in turn consists of 3 phases. You have to get to that script using whatever installation editor you have. There will be various Actions, AppSearch and CostFinalize among them.
0
Vadim RappCommented:
of course, I object. It would be very interesting to know why this request is even posted after precise instructions were given.
0
Vadim RappCommented:
sorry, I re-read the original question, and I think I have to retract my objection. The request was to do it in vbscript, which I overlooked. I think I know the solution, but it should had been posted before the request for deletion.  If the asker indicates that he/she still wants it, I can provide it.
0
MichelJalletAuthor Commented:
I still need the solution. I deleted this request by error.
0
Vadim RappCommented:
OK... do this:

in vbscript, read the registry and get the location you want.

Let's suppose, what you read was "C:\PROGRAM FILES\TEST33"
Then from vbscript launch the installation like this:

msiexec.exe /package "C:\Inetpub\wwwroot\crm\test.MSI" INSTALLDIR="C:\PROGRAM FILES\TEST33"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vadim RappCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup Zone:

accept comment from vadimrapp1 , ID:20903853

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

vadimrapp1, Experts Exchange Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.