473,503 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

want to use this code in C#

Hi,

i'm trying to run a program from the %ProgramFiles% with no success,what is
the problem with this code'why i can't run the program,i've to use the
%ProgramFiles%,Plz help with this code

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName = Environment.SpecialFolder.ProgramFiles
+ @"%programfiles%\Outlook Express\msimn.exe";
Outlook_Express.Start();

Thanks
Jun 4 '06 #1
9 1297

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

i'm trying to run a program from the %ProgramFiles% with no success,what
is
the problem with this code'why i can't run the program,i've to use the
%ProgramFiles%,Plz help with this code

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName =
Environment.SpecialFolder.ProgramFiles
+ @"%programfiles%\Outlook Express\msimn.exe";
Outlook_Express.Start();

RTFM.
it took mi 2 minutes to find this in help:

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName =
Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles)
+ @"\Outlook Express\msimn.exe";
Outlook_Express.Start();
Jun 4 '06 #2
Avi G wrote:
Hi,

i'm trying to run a program from the %ProgramFiles% with no success,what is
the problem with this code'why i can't run the program,i've to use the
%ProgramFiles%,Plz help with this code

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName = Environment.SpecialFolder.ProgramFiles
+ @"%programfiles%\Outlook Express\msimn.exe";
Outlook_Express.Start();


Use Environment.GetFolderPath():

string programFilesFolder
= Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles);
string outlookExpressPath
= Path.Combine(programFilesFolder, @"Outlook Express\msimn.exe");

hth,
Max
Jun 4 '06 #3
btw, aren't "@"%programfiles%" implies the "C:\Program Files" already?

"Avi G" <Av**@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:E9********************************* *@microsoft.com...
Hi,

i'm trying to run a program from the %ProgramFiles% with no success,what
is
the problem with this code'why i can't run the program,i've to use the
%ProgramFiles%,Plz help with this code

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName =
Environment.SpecialFolder.ProgramFiles
+ @"%programfiles%\Outlook Express\msimn.exe";
Outlook_Express.Start();

Thanks

Jun 5 '06 #4
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.GetFolderPath(Environment.SpecialFolde r.System)
or it's point to somewhere else,i need the %systemroot%.

"Artur Borecki" wrote:

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi,

i'm trying to run a program from the %ProgramFiles% with no success,what
is
the problem with this code'why i can't run the program,i've to use the
%ProgramFiles%,Plz help with this code

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName =
Environment.SpecialFolder.ProgramFiles
+ @"%programfiles%\Outlook Express\msimn.exe";
Outlook_Express.Start();

RTFM.
it took mi 2 minutes to find this in help:

Process Outlook_Express = new Process();
Outlook_Express.StartInfo.FileName =
Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles)
+ @"\Outlook Express\msimn.exe";
Outlook_Express.Start();

Jun 5 '06 #5

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.GetFolderPath(Environment.SpecialFolde r.System)
or it's point to somewhere else,i need the %systemroot%.

System.Console.Write(Environment.GetFolderPath(Env ironment.SpecialFolder.System));
and you know everything.
Jun 5 '06 #6
i still can't find there the code for the %systemroot%,can you help?

"Artur Borecki" wrote:

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.GetFolderPath(Environment.SpecialFolde r.System)
or it's point to somewhere else,i need the %systemroot%.

System.Console.Write(Environment.GetFolderPath(Env ironment.SpecialFolder.System));
and you know everything.

Jun 5 '06 #7
I can't find any SpecialFolder enum for that...

So maybe just remove anything after the "\" character.

"Avi G" <Av**@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:78********************************* *@microsoft.com...
i still can't find there the code for the %systemroot%,can you help?

"Artur Borecki" wrote:

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
> ok,thanks it's working
> tell me is this code point to %systemroot%
> Environment.GetFolderPath(Environment.SpecialFolde r.System)
> or it's point to somewhere else,i need the %systemroot%.

System.Console.Write(Environment.GetFolderPath(Env ironment.SpecialFolder.System));
and you know everything.

Jun 7 '06 #8
Try :

Console.WriteLine(Environment.GetEnvironmentVariab le("SystemRoot"));
Console.WriteLine(Environment.GetEnvironmentVariab le("WinDir"));
Console.WriteLine(Environment.GetEnvironmentVariab le("ProgramFiles"));

That might help.

Cheers,
Yash

Jun 21 '06 #9
Alternatively you could use:

Console.WriteLine(Environment.ExpandEnvironmentVar iables("%SystemRoot%"));
Console.WriteLine(Environment.ExpandEnvironmentVar iables("%ProgramFiles%"));
Console.WriteLine(Environment.ExpandEnvironmentVar iables("%WINDIR%"));

In the query (%***%), the *** part is case insensitive.

I hope that helps.

Yash

ya*****@gmail.com wrote:
Try :

Console.WriteLine(Environment.GetEnvironmentVariab le("SystemRoot"));
Console.WriteLine(Environment.GetEnvironmentVariab le("WinDir"));
Console.WriteLine(Environment.GetEnvironmentVariab le("ProgramFiles"));

That might help.

Cheers,
Yash


Jun 21 '06 #10

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

Similar topics

3
2979
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
2
12799
by: SL_McManus | last post by:
Hi All; I am fairly new to Perl. I have a file with close to 3000 lines that I would like to split out in a certain way. I would like to put the record type starting in column 1 for 2 spaces,...
14
1857
by: lutorm | last post by:
Hi, I'm having a problem with a return statement being parsed to return a function (I think). Check here: template <typename T> class A {}; template <typename T> class maker_of_A { public:...
0
1056
by: Shawn A. Hall | last post by:
First, I apologize if this isn't the right group to post this question, but I didn't see a newsgroup specific to CodeDom so here I am. On to my question: I am trying to use CodeDom to generate...
3
1580
by: hazz | last post by:
The following classes follow from the base class ' A ' down to the derived class ' D ' at the bottom of the inheritance chain. I am calling the class at the bottom, "public class D" from a client...
182
7356
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
4
19459
by: eewwttww | last post by:
how to save with only WebBrowser: save html+picture without dialog box? what I Have is: WebBrowser.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, 300, 300 I don't want this code. I want...
4
2107
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
5
1428
by: Ron | last post by:
I've got some C# code that sort of does what I want: Looking at the xml files in area: http://www.keepitsimplekid.com/xml I want to change Untitled Ad at the top of the xml to the name of the...
4
4440
by: Alan Mailer | last post by:
Again, I'm new to VB.net and there is something I need help with: Like (I assume) many of us, over time I want to be able to create some VB.net classes that I might want to use in more than one...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
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,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
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...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
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,...
0
4673
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...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
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 ...

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.