![]() |
|
|
#1 |
|
Guest
Posts: n/a
|
Find a Program Path
Hi,
I have created a batch file in C# and want to find and place it in the path of an installed application. Now, this might be done on an XP, 2000, etc system. The application is installed and will likely be in the registry. Does anyone know of anything in C# to check the registry for a particular application path? Say, for instance, i needed to find the Word path and place a file in it... how to check the registry through code for this? Thanks! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
RE: Find a Program Path
"Soulless" wrote: > Hi, > > I have created a batch file in C# and want to find and place it in the > path of an installed application. Now, this might be done on an XP, > 2000, etc system. The application is installed and will likely be in > the registry. Does anyone know of anything in C# to check the > registry for a particular application path? > > Say, for instance, i needed to find the Word path and place a file in > it... how to check the registry through code for this? > > Thanks! > Word can be found by looking at the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0 \Word\InstallRoot" as "Path". This is for 2007. It may not hold true for other versions. You shouldn't count on the registry containing the info for any given application. There is no standard for this. Also, you should not count on the folder being writable by any given process such as copying your bat file too it. To get the value above, use the following: string sKey = @"\Software\Microsoft\Office\12.0\Word\InstallRoot "; RegistryKey key = Registry.LocalMachine.OpenSubKey(sKey); key.GetValue("Path"); |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|