473,805 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!
Dec 14 '07 #1
3 3252


"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_MAC HINE\SOFTWARE\M icrosoft\Office \12.0\Word\Inst allRoot" 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\Mic rosoft\Office\1 2.0\Word\Instal lRoot";
RegistryKey key = Registry.LocalM achine.OpenSubK ey(sKey);
key.GetValue("P ath");

Dec 15 '07 #2
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
SHi,
S>
SI have created a batch file in C# and want to find and place it in
Sthe path of an installed application. Now, this might be done on an
SXP, 2000, etc system. The application is installed and will likely
Sbe in the registry. Does anyone know of anything in C# to check the
Sregistry for a particular application path?
S>
SSay, for instance, i needed to find the Word path and place a file in
Sit... how to check the registry through code for this?
S>
SThanks!
S>
Dec 15 '07 #3
On Dec 15, 1:02 am, Michael Nemtsev [MVP] <nemt...@msn.co mwrote:
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

SHi,
S>
SI have created a batch file in C# and want to find and place it in
Sthe path of an installed application. Now, this might be done on an
SXP, 2000, etc system. The application is installed and will likely
Sbe in the registry. Does anyone know of anything in C# to check the
Sregistry for a particular application path?
S>
SSay, for instance, i needed to find the Word path and place a file in
Sit... how to check the registry through code for this?
S>
SThanks!
S>
Thanks! I am going to try to find the folder for the user and then
prompt, hopefully making life easier for all. :)
Dec 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1843
by: Andreas Neudecker | last post by:
Hi. I know you can read the filename of a program as sys.argv. But what about modules? Is there a similar way to find out the file name of a module (called by some other module or program) from inside this module? Kind regards Andreas
6
1781
by: Peter Hansen | last post by:
Greetings. Im trying to write a program that can be run from the command line. If I want to search for example after a file with the ending .pdf, I should be able to write in the command line: python name of my program / the libary to search and what kind of file it is example a .pdf file So if my program name was test.py and the library name was library1 and the test type i wanted to find was, a .pdf file I should write python...
1
4511
by: Alex | last post by:
Hello, in my company, we have a diagnostic tool for hardware. Depending on the hardware projcet, a different project configuration is needed. The configuration file is written in XML and contains information for the visualization and storage of the retrieved data. From mid july till now, i have made 4 different configuration sets and everything was fine. Today, i got the order to make a new configuration set. When the xml file was...
29
3899
by: chellappa | last post by:
hi all I need to write a program to find mac address of a my computer using libaries, is this possible? How? thanks
5
61943
by: sathya moorthy via .NET 247 | last post by:
(Type your message here) hi. i am doing a small application project in c#. can any one help me how to find the directory of the current running program. how to create the input box in c# program. -------------------------------- From: sathya moorthy ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/)
0
1076
by: citizenkahn | last post by:
I am trying to parse a build log for errors. I figure I can do this one of three ways: - find the absolute platonic form of an error and search for that item - create definitions of what patterns describe errors for each tool which is used (ant, MSDEV, etc). - rework the build such that all the return codes for all 3rd party are captured and logged using my own error description The return code method has a high level of effort...
0
1345
by: John Doe | last post by:
Windows XP Visual Studio 2003 NET Visual C++ When I tried to run without debugging, I get a message that says it can't find a path. The path did exist on my computer. I cannot find the path text (my search criteria is only one word from the path) in the solution or anywhere on my computer. Here is the error when I try to run without debugging, after
0
2532
by: drewmania001 | last post by:
When trying to setup relplication for SQL i am getting the following error. "The system cannot find the path specified" The problem is when trying to run: sp_adddistributiondb line 434: RAISERROR (14113, 16, -1, @osql_cmd, 'instdist.out') The details... MSDE2 SP3 Win 2003 STANDARD edition
6
2930
by: HONOREDANCESTOR | last post by:
Suppose I have a dll which might be installed in the directory c: \MyClass\. I want to be able to find the path of this dll from within the dll. In other words, I want a function that can return "c: \MyClass". I cannot use Application.GetExecutablePath from within the dll, because that gives me the path of the application that is calling the dll. This question was also asked on this forum back in 2002, and Microsoft had no answer to...
7
3147
by: latalui | last post by:
i am a beginner, guys plizzzzzzzz help me. i am given a assignment to find short paths either using dijkstra algorithm or using binary search algorithm in linux OS. check out what is wrong the code i tried /program to find shortest path #include<stdio.h> #include<cstdlib> #include<cstring> #include<fstream> #include<iostream.h> #define member 1 // use to indicate current node
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.