473,480 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Passing an option to an EXE from an EXE

Greetings to all,

I really appreciate the support from this community and I've made some
advancements, but again I'm hitting a wall...

I'm trying to write a program in C# that passes an option to another EXE so
that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

As a test, I tried "Run" option of Windows as below:
"c:\program files\program\sample.exe" /option:"doSomething"
and this works fine.

I'm puzzled as to what the problem is.
What am I doing wrong?

Thanks very much for your help!

Cheers,

Takuya

Jul 21 '05 #1
7 1114
Remember the syntax of strings in C#. I think you want to type this:

System.Diagnostics.Process.Start(
"\"c:\\Program FIles\\Program\\Sample.exe\" /option:\"doSomething\"");

That is, put \ before every \ or " that occurs within a string.
"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

I really appreciate the support from this community and I've made some
advancements, but again I'm hitting a wall...

I'm trying to write a program in C# that passes an option to another EXE so
that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

As a test, I tried "Run" option of Windows as below:
"c:\program files\program\sample.exe" /option:"doSomething"
and this works fine.

I'm puzzled as to what the problem is.
What am I doing wrong?

Thanks very much for your help!

Cheers,

Takuya

Jul 21 '05 #2
> Remember the syntax of strings in C#. I think you want to type this:

System.Diagnostics.Process.Start(
"\"c:\\Program FIles\\Program\\Sample.exe\" /option:\"doSomething\"");

That is, put \ before every \ or " that occurs within a string.

Woops, my typing mistake.
I had actually done so.

Cheers,

Takuya

Jul 21 '05 #3
<irrelevant newsgroups removed>
"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp>
wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

<snipped>

I'm trying to write a program in C# that passes an option to another EXE so that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

<snipped>

Cheers,

Takuya


The Process class' "Start" method has an override specifically for supplying
arguments to the executable being started. In your case, the syntax would
be:
System.Diagnostics.Process.Start("C:\\Program Files\\Program\\Sample.exe",
"/option:\"doSomething\"");

Good luck.
--
Ryan LaNeve, MCSD.NET
http://weblogs.asp.net/rlaneve
Jul 21 '05 #4
hi,

i think you can also put an @ before your string, then the echap char would
be automatic.
@"c:\program files\program\sample.exe" would work i suppose.

ROM

"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> a
ecrit dans le message de news: #X**************@TK2MSFTNGP12.phx.gbl...
Remember the syntax of strings in C#. I think you want to type this:

System.Diagnostics.Process.Start(
"\"c:\\Program FIles\\Program\\Sample.exe\" /option:\"doSomething\"");

That is, put \ before every \ or " that occurs within a string.
"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp>
wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

I really appreciate the support from this community and I've made some
advancements, but again I'm hitting a wall...

I'm trying to write a program in C# that passes an option to another EXE so that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

As a test, I tried "Run" option of Windows as below:
"c:\program files\program\sample.exe" /option:"doSomething"
and this works fine.

I'm puzzled as to what the problem is.
What am I doing wrong?

Thanks very much for your help!

Cheers,

Takuya

Jul 21 '05 #5
I don't have it in front of me, but I was pretty sure that there is an
overload for process.start that allows you to pass a command line argument.
It's not all passed as one string. The overloads second parameter is an
object array if I remember correctly.

Phil

"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp>
wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

I really appreciate the support from this community and I've made some
advancements, but again I'm hitting a wall...

I'm trying to write a program in C# that passes an option to another EXE so that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

As a test, I tried "Run" option of Windows as below:
"c:\program files\program\sample.exe" /option:"doSomething"
and this works fine.

I'm puzzled as to what the problem is.
What am I doing wrong?

Thanks very much for your help!

Cheers,

Takuya

Jul 21 '05 #6
Yes, Phil!
It worked perfectly.
Thanks very much for your help!
Cheers,
Takuya
"Phil Swartzell" <ps*********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I don't have it in front of me, but I was pretty sure that there is an
overload for process.start that allows you to pass a command line argument. It's not all passed as one string. The overloads second parameter is an
object array if I remember correctly.

Phil

"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

I really appreciate the support from this community and I've made some
advancements, but again I'm hitting a wall...

I'm trying to write a program in C# that passes an option to another EXE

so
that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

As a test, I tried "Run" option of Windows as below:
"c:\program files\program\sample.exe" /option:"doSomething"
and this works fine.

I'm puzzled as to what the problem is.
What am I doing wrong?

Thanks very much for your help!

Cheers,

Takuya



Jul 21 '05 #7
Thanks Ryan,

It worked great the way you specified it.
Cheers,

Takuya
"Ryan LaNeve" <ry**@nolanevespam.com> wrote in message
news:uv**************@TK2MSFTNGP12.phx.gbl...
<irrelevant newsgroups removed>
"Takuya Matsumoto" <ad*************************************@sakaecorp .co.jp> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl...
Greetings to all,

<snipped>

I'm trying to write a program in C# that passes an option to another EXE so
that the second program knows what to do.
I belive the syntax is like below, but the problem arises when I add the
option; it does not find the exe file.

System.Diagnostics.Process.Start("c:\program files\program\sample.exe"
/option:"doSomething");

<snipped>

Cheers,

Takuya


The Process class' "Start" method has an override specifically for

supplying arguments to the executable being started. In your case, the syntax would
be:
System.Diagnostics.Process.Start("C:\\Program Files\\Program\\Sample.exe",
"/option:\"doSomething\"");

Good luck.
--
Ryan LaNeve, MCSD.NET
http://weblogs.asp.net/rlaneve


Jul 21 '05 #8

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

Similar topics

7
10686
by: Matthew Robinson | last post by:
i read a tutorial the other day on passing variables between php pages using a html form and setting the action to the php page to parse, can anybody see anything wrong with the code below? the...
4
1621
by: bateman | last post by:
Hi, I have a rather puzzling problem, have asked the ASP experts at work with no joy and its driving me mad! I'll explain the steps in more detail below but the general problem is I am manually...
12
6501
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
9
2139
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
6
2779
by: Catherine Jones | last post by:
Hi all, we need urgent help in a matter. We are trying to pass a COM object from the client to server and are facing some problems in the same. We've our client in C# as well as the Server...
4
2958
by: Gr8North | last post by:
I'm relatively new to .Net, and would appreciate a little assistance. I have multiple datasets attached to individual grids on individual tabs on a form. I would like to have a series of...
3
2590
by: dice | last post by:
Hi, In order to use an external api call that requires a function pointer I am currently creating static wrappers to call my objects functions. I want to re-jig this so I only need 1 static...
7
8175
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
11
3733
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
6
2615
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
0
7039
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,...
0
6904
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
7037
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
7080
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...
0
4476
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
2992
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...
0
1296
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 ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
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...

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.