473,657 Members | 2,423 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.File Name = Environment.Spe cialFolder.Prog ramFiles
+ @"%programfiles %\Outlook Express\msimn.e xe";
Outlook_Express .Start();

Thanks
Jun 4 '06 #1
9 1304

"Avi G" <Av**@discussio ns.microsoft.co m> wrote in message
news:E9******** *************** ***********@mic rosoft.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.File Name =
Environment.Spe cialFolder.Prog ramFiles
+ @"%programfiles %\Outlook Express\msimn.e xe";
Outlook_Express .Start();

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

Process Outlook_Express = new Process();
Outlook_Express .StartInfo.File Name =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles)
+ @"\Outlook Express\msimn.e xe";
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.File Name = Environment.Spe cialFolder.Prog ramFiles
+ @"%programfiles %\Outlook Express\msimn.e xe";
Outlook_Express .Start();


Use Environment.Get FolderPath():

string programFilesFol der
= Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles);
string outlookExpressP ath
= Path.Combine(pr ogramFilesFolde r, @"Outlook Express\msimn.e xe");

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

"Avi G" <Av**@discussio ns.microsoft.co m> ¼¶¼g©ó¶l¥ó·s»D: 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.File Name =
Environment.Spe cialFolder.Prog ramFiles
+ @"%programfiles %\Outlook Express\msimn.e xe";
Outlook_Express .Start();

Thanks

Jun 5 '06 #4
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.Get FolderPath(Envi ronment.Special Folder.System)
or it's point to somewhere else,i need the %systemroot%.

"Artur Borecki" wrote:

"Avi G" <Av**@discussio ns.microsoft.co m> wrote in message
news:E9******** *************** ***********@mic rosoft.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.File Name =
Environment.Spe cialFolder.Prog ramFiles
+ @"%programfiles %\Outlook Express\msimn.e xe";
Outlook_Express .Start();

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

Process Outlook_Express = new Process();
Outlook_Express .StartInfo.File Name =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles)
+ @"\Outlook Express\msimn.e xe";
Outlook_Express .Start();

Jun 5 '06 #5

"Avi G" <Av**@discussio ns.microsoft.co m> wrote in message
news:0C******** *************** ***********@mic rosoft.com...
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.Get FolderPath(Envi ronment.Special Folder.System)
or it's point to somewhere else,i need the %systemroot%.

System.Console. Write(Environme nt.GetFolderPat h(Environment.S pecialFolder.Sy stem));
and you know everything.
Jun 5 '06 #6
i still can't find there the code for the %systemroot%,ca n you help?

"Artur Borecki" wrote:

"Avi G" <Av**@discussio ns.microsoft.co m> wrote in message
news:0C******** *************** ***********@mic rosoft.com...
ok,thanks it's working
tell me is this code point to %systemroot%
Environment.Get FolderPath(Envi ronment.Special Folder.System)
or it's point to somewhere else,i need the %systemroot%.

System.Console. Write(Environme nt.GetFolderPat h(Environment.S pecialFolder.Sy stem));
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**@discussio ns.microsoft.co m> ¼¶¼g©ó¶l¥ó·s»D: 78************* *************** ******@microsof t.com...
i still can't find there the code for the %systemroot%,ca n you help?

"Artur Borecki" wrote:

"Avi G" <Av**@discussio ns.microsoft.co m> wrote in message
news:0C******** *************** ***********@mic rosoft.com...
> ok,thanks it's working
> tell me is this code point to %systemroot%
> Environment.Get FolderPath(Envi ronment.Special Folder.System)
> or it's point to somewhere else,i need the %systemroot%.

System.Console. Write(Environme nt.GetFolderPat h(Environment.S pecialFolder.Sy stem));
and you know everything.

Jun 7 '06 #8
Try :

Console.WriteLi ne(Environment. GetEnvironmentV ariable("System Root"));
Console.WriteLi ne(Environment. GetEnvironmentV ariable("WinDir "));
Console.WriteLi ne(Environment. GetEnvironmentV ariable("Progra mFiles"));

That might help.

Cheers,
Yash

Jun 21 '06 #9
Alternatively you could use:

Console.WriteLi ne(Environment. ExpandEnvironme ntVariables("%S ystemRoot%"));
Console.WriteLi ne(Environment. ExpandEnvironme ntVariables("%P rogramFiles%")) ;
Console.WriteLi ne(Environment. ExpandEnvironme ntVariables("%W INDIR%"));

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

I hope that helps.

Yash

ya*****@gmail.c om wrote:
Try :

Console.WriteLi ne(Environment. GetEnvironmentV ariable("System Root"));
Console.WriteLi ne(Environment. GetEnvironmentV ariable("WinDir "));
Console.WriteLi ne(Environment. GetEnvironmentV ariable("Progra mFiles"));

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
2990
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 waste of time to start writing yet another IDE and so am now thinking in terms of new features/plug-ins for existing systems. Right now I mostly use Komodo Personal and it's pretty close to being what I want. They don't currently support plug-ins,...
2
12822
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, the employer code in column 23 for 29 spaces and employer description in column 53 for 30 spaces. I have tried modifying an existing file with no real success. I haven't found anything that specifically answers my question. Any guidance would be...
14
1873
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: A<T>& make_A() {return A<T>();}; };
0
1069
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 Method, Property, and Member code, but ONLY that code. It appears as though the only way to generate code is through the CodeGenerator/CodeProvider, which you have to attach a namespace then a class to the namespace then your members to that...
3
1588
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 app with; D m_D = new D(tkn); public class A : MarshalByRefObject public A () <--------------------- public class B : A public B () <----------------------
182
7491
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
4
19466
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 same code like this: WebBrowserSaveTo("c:\html\1\",htm+pic) what I can do?
4
2119
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) and the Language Objects Library) that I have converted over to C#. It works okay. However, in the C# version, one has to build the class library into the generated application, because I haven't structured this one thing right. I would like to...
5
1431
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 etn advertiser name in this xml for example LEAF GUARD OF LAKE ERIE or REGIONAL CANCER CENTER, whatever is in that ETS Advertiser I want to move to Untitled Ad, right now as you can see by the code I hard code LEAF GUARD OF LAKE ERIE into the...
4
4459
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 Project. So let's say I've created a Folder called "MyVBNet Classes" to hold these general-use VB.Net class files that I will eventually associate with various Projects I create. Now let's imagine I've created a class called "MyClass.vb" that...
0
8394
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
8825
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...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
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
5632
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
4152
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
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.