• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

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).
0
MichelJallet
Asked:
MichelJallet
  • 6
  • 5
  • 5
1 Solution
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 6
  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now