Find a Program Path

  • Thread starter Thread starter Soulless
  • Start date Start date
S

Soulless

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!
 
Soulless said:
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");
 
Hello Soulless,

there is no standard way to do it
just ask user to point to the installed folder

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


S> Hi,
S>
S> I have created a batch file in C# and want to find and place it in
S> the path of an installed application. Now, this might be done on an
S> XP, 2000, etc system. The application is installed and will likely
S> be in the registry. Does anyone know of anything in C# to check the
S> registry for a particular application path?
S>
S> Say, for instance, i needed to find the Word path and place a file in
S> it... how to check the registry through code for this?
S>
S> Thanks!
S>
 
Hello Soulless,

there is no standard way to do it
just ask user to point to the installed folder

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

S> Hi,
S>
S> I have created a batch file in C# and want to find and place it in
S> the path of an installed application. Now, this might be done on an
S> XP, 2000, etc system. The application is installed and will likely
S> be in the registry. Does anyone know of anything in C# to check the
S> registry for a particular application path?
S>
S> Say, for instance, i needed to find the Word path and place a file in
S> it... how to check the registry through code for this?
S>
S> Thanks!
S>

Thanks! I am going to try to find the folder for the user and then
prompt, hopefully making life easier for all. :)
 

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

Similar Threads

Find Path To Client Application 3
Finding A Specific TreNode 6
Path 4
Get file path 3
get folder-path from file-path 4
Get Path of file 5
pulling in native DLLs from multiple other paths 2
VS Setup Project... 4

Back
Top