How to make a .reg file which knows where to find a program it needs?

H

Halcyon Daze

(I added some info from the last time I posted, to clarify)
--------------------------------------------
I have a .reg file which looks like this:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\someprogram\Shell\open\command]
@="C:\\SomeProgram\\System\\TheProgram.exe \"%1-flag\""

(Notice the C:\ path - if the user doesn't have it installed there, the
reg file is useless!)

I want to make this location (C:\) change, depending where someone
installed SomeProgram.

There is another registry key, default, which already should exist on
the computers of people who have installed SomeProgram:

My Computer\HKEY_CLASSES_ROOT\Applications\TheProgram.exe\shell\open\command

***This key contains the installed path of the program!!!! (yay!)

Is there a way to make my little .reg file "know" where SomeProgram is
installed, if not C:\ ?

Thanks very much!
-Andy
 
T

Tom Brown

Halcyon Daze said:
(I added some info from the last time I posted, to clarify)
--------------------------------------------
I have a .reg file which looks like this:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\someprogram\Shell\open\command]
@="C:\\SomeProgram\\System\\TheProgram.exe \"%1-flag\""

(Notice the C:\ path - if the user doesn't have it installed there, the
reg file is useless!)

I want to make this location (C:\) change, depending where someone
installed SomeProgram.

There is another registry key, default, which already should exist on
the computers of people who have installed SomeProgram:

My Computer\HKEY_CLASSES_ROOT\Applications\TheProgram.exe\shell\open\command

***This key contains the installed path of the program!!!! (yay!)

Is there a way to make my little .reg file "know" where SomeProgram is
installed, if not C:\ ?


Hi,
REG files can't do that, you should look at WSH

Set WshShell = WScript.CreateObject("WScript.Shell")
loc = WshShell.RegRead("HKCR\Applications\TheProg\shell...")
WshShell.RegWrite "HKCR\someprogram\Shell\...", loc
 
T

Tom Brown

Halcyon Daze said:
(I added some info from the last time I posted, to clarify)
--------------------------------------------
I have a .reg file which looks like this:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\someprogram\Shell\open\command]
@="C:\\SomeProgram\\System\\TheProgram.exe \"%1-flag\""

(Notice the C:\ path - if the user doesn't have it installed there, the
reg file is useless!)

I want to make this location (C:\) change, depending where someone
installed SomeProgram.

There is another registry key, default, which already should exist on
the computers of people who have installed SomeProgram:

My Computer\HKEY_CLASSES_ROOT\Applications\TheProgram.exe\shell\open\command

***This key contains the installed path of the program!!!! (yay!)

Is there a way to make my little .reg file "know" where SomeProgram is
installed, if not C:\ ?


Hi,
REG files can't do that, you should look at WSH

Set WshShell = WScript.CreateObject("WScript.Shell")
loc = WshShell.RegRead("HKCR\Applications\TheProg\shell...")
WshShell.RegWrite "HKCR\someprogram\Shell\...", loc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top