473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1112
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
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
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
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
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
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
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
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
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
11
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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
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...

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.