Using the registry to create a variable

  • Thread starter Thread starter Halcyon Daze
  • Start date Start date
H

Halcyon Daze

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

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\SomeProgram.exe\shell\open\command

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

Thanks very much!
-Andy
 
In said:
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:\

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\SomeProgram.exe\shell\open\
command

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

Difficult to say without knowing what registry entries were made when
the application was installed. It may have written in
HKLN\Software\ProgramName
or
HKLM\Software\VendorName\ProgramName

If it installed by using an Windows Installer Package (MSI, WISE,
etc) (and especially if it appears in Add/Remove) then look to
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\program
\ ...

Then read the valuename/data and parse out the drive letter.
REG.EXE in the Support Tools may help here.

But would it not be easier to do a directory searching for the
ProgramName.exe and then get the installed-on drive letter. Possibly
with %~D1 in batch.
 
Back
Top