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

  • Thread starter Thread starter Halcyon Daze
  • Start date Start date
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
 
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
 
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
 
Back
Top