473,405 Members | 2,287 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,405 software developers and data experts.

Unable to run .exe application using C# code

Hi,

I have an exe that i need to call from my C# Program with two
arguments(filenames)

for example
Suppose if i have an application "test.exe" , whose functionality is to
convert a '.doc' file to '.txt' file
On cmd i would normally give the following command as:

test.exe abc.doc xyz.txt

and it works fine and performs its job of conversion.

but what if i want to execute the same thing using my c# code.
i am using the following sample code:

Process compiler = new Process();
compiler.StartInfo.FileName = "test.exe" ;
compiler.StartInfo.Arguments = "abc.doc xyz.txt" ;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

when i try to invoke the test.exe using the above code , it fails to
perform its operation of conversion.

how is setworking directory to be used?
how should we specify the path for all the files.?
how should we give the path for the above files to be used?

Can anyone tell me if i need to add anything more to the above code

It would be great if somebody could provide some help on the above
topic.

Jan 11 '07 #1
4 7146
Did you put test.exe and you program together?
If not, you should give the full name of test.exe .
Such as:
Process.Start("c:\\test.exe","abc.doc xyz.txt");
<kb******@gmail.com>
??????:11**********************@p59g2000hsd.google groups.com...
Hi,

I have an exe that i need to call from my C# Program with two
arguments(filenames)

for example
Suppose if i have an application "test.exe" , whose functionality is to
convert a '.doc' file to '.txt' file
On cmd i would normally give the following command as:

test.exe abc.doc xyz.txt

and it works fine and performs its job of conversion.

but what if i want to execute the same thing using my c# code.
i am using the following sample code:

Process compiler = new Process();
compiler.StartInfo.FileName = "test.exe" ;
compiler.StartInfo.Arguments = "abc.doc xyz.txt" ;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

when i try to invoke the test.exe using the above code , it fails to
perform its operation of conversion.

how is setworking directory to be used?
how should we specify the path for all the files.?
how should we give the path for the above files to be used?

Can anyone tell me if i need to add anything more to the above code

It would be great if somebody could provide some help on the above
topic.

Jan 11 '07 #2


Thanks for the suggestion !
Actually i have tried this , but still does'nt seem to work
if u have some other suggestion , plz do post again.

bhavesh

<lijg...@gmail.comwrote:
Did you put test.exe and you program together?
If not, you should give the full name of test.exe .
Such as:
Process.Start("c:\\test.exe","abc.doc xyz.txt");
<kb******@gmail.com>
??????:11**********************@p59g2000hsd.google groups.com...
Hi,

I have an exe that i need to call from my C# Program with two
arguments(filenames)

for example
Suppose if i have an application "test.exe" , whose functionality is to
convert a '.doc' file to '.txt' file
On cmd i would normally give the following command as:

test.exe abc.doc xyz.txt

and it works fine and performs its job of conversion.

but what if i want to execute the same thing using my c# code.
i am using the following sample code:

Process compiler = new Process();
compiler.StartInfo.FileName = "test.exe" ;
compiler.StartInfo.Arguments = "abc.doc xyz.txt" ;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

when i try to invoke the test.exe using the above code , it fails to
perform its operation of conversion.

how is setworking directory to be used?
how should we specify the path for all the files.?
how should we give the path for the above files to be used?

Can anyone tell me if i need to add anything more to the above code

It would be great if somebody could provide some help on the above
topic.
Jan 11 '07 #3
Try like this:
Process.Start("c:\\test.exe","c:\\abc.doc c:\\xyz.txt");

<kb******@gmail.com>
??????:11**********************@i39g2000hsf.google groups.com...
>

Thanks for the suggestion !
Actually i have tried this , but still does'nt seem to work
if u have some other suggestion , plz do post again.

bhavesh

<lijg...@gmail.comwrote:
>Did you put test.exe and you program together?
If not, you should give the full name of test.exe .
Such as:
Process.Start("c:\\test.exe","abc.doc xyz.txt");
<kb******@gmail.com>
??????:11**********************@p59g2000hsd.googl egroups.com...
Hi,

I have an exe that i need to call from my C# Program with two
arguments(filenames)

for example
Suppose if i have an application "test.exe" , whose functionality is to
convert a '.doc' file to '.txt' file
On cmd i would normally give the following command as:

test.exe abc.doc xyz.txt

and it works fine and performs its job of conversion.

but what if i want to execute the same thing using my c# code.
i am using the following sample code:

Process compiler = new Process();
compiler.StartInfo.FileName = "test.exe" ;
compiler.StartInfo.Arguments = "abc.doc xyz.txt" ;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

when i try to invoke the test.exe using the above code , it fails to
perform its operation of conversion.

how is setworking directory to be used?
how should we specify the path for all the files.?
how should we give the path for the above files to be used?

Can anyone tell me if i need to add anything more to the above code

It would be great if somebody could provide some help on the above
topic.

Jan 11 '07 #4
Is it required to have all the files in the same directory?
For example:
Process.Start("C:\\My Folder\\test.exe", "D:\\abc.doc C:\\test
folder\\xyz.txt");

Will it work?

Thanks,
BK
<lijg...@gmail.comwrote:
Try like this:
Process.Start("c:\\test.exe","c:\\abc.doc c:\\xyz.txt");

<kb******@gmail.com>
??????:11**********************@i39g2000hsf.google groups.com...


Thanks for the suggestion !
Actually i have tried this , but still does'nt seem to work
if u have some other suggestion , plz do post again.

bhavesh

<lijg...@gmail.comwrote:
Did you put test.exe and you program together?
If not, you should give the full name of test.exe .
Such as:
Process.Start("c:\\test.exe","abc.doc xyz.txt");
<kb******@gmail.com>
??????:11**********************@p59g2000hsd.google groups.com...
Hi,

I have an exe that i need to call from my C# Program with two
arguments(filenames)

for example
Suppose if i have an application "test.exe" , whose functionality is to
convert a '.doc' file to '.txt' file
On cmd i would normally give the following command as:

test.exe abc.doc xyz.txt

and it works fine and performs its job of conversion.

but what if i want to execute the same thing using my c# code.
i am using the following sample code:

Process compiler = new Process();
compiler.StartInfo.FileName = "test.exe" ;
compiler.StartInfo.Arguments = "abc.doc xyz.txt" ;
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

when i try to invoke the test.exe using the above code , it fails to
perform its operation of conversion.

how is setworking directory to be used?
how should we specify the path for all the files.?
how should we give the path for the above files to be used?

Can anyone tell me if i need to add anything more to the above code

It would be great if somebody could provide some help on the above
topic.
Jan 12 '07 #5

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

Similar topics

2
by: Carlos G Benevides | last post by:
I have a ASP.Net web application that has two assemblies that run under com+. Under Windows 2000 the two assemblies are added to com+ automatically when instantiated from the web site. For this...
3
by: StephenRichter | last post by:
I have installed the trial of db2 enterprise server on my w2k PC. Have also installed fix pack 8 of that product. I am using it to connect from an asp.net web page to an IBM as400. the 400 is...
3
by: kuldeep | last post by:
Hi all, I have a application developed in C# .net. The problem I face is I am unable to shutdown my machine when the exe is running. Windows is unable to close this exe an shut down. Can anyone...
0
by: Amy | last post by:
Hi, I'm suddenly getting this error when I post back from my application. the application worked once, i added some code on one page (customizing a datagrid), and suddenly I'm getting this...
10
by: Mythran | last post by:
When I try to open a web project using Microsoft Visual Studio 2003, I get the following error message (this happens on a couple of machines in-house, while on the rest it works without the error):...
1
by: TRI_CODER | last post by:
I am trying to solve the following exception. The exception occurs when my ASP.NET code behind code attemtps to access a remore site using SSL. Please note that all certificates are valid and the...
6
by: Bob Rock | last post by:
Hello, I'm using an executable (for which I do not have the source code nor the pdb file) as the startup application to load a DLL I'm writing and need to debug. If I try to debug the DLL I...
6
by: Solje | last post by:
Im developing an ASP.NET application used for maintinance purpose and it may be idle for some ours. The application crash with the error shown below when the user click on some contol in the...
8
by: =?Utf-8?B?RGFuTQ==?= | last post by:
Can someone help with the following problem. I am sending an encrypted SOAP message to a .NET 2.0 + WSE 3.0 web service. When .NET attempts to decrypt the message it cannot read the private key...
1
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
Hello, Using VS2008 in a C# web service application, a class has been created that inherits from the ConfigurationSelection. This class file has been placed in the App_Code folder. The...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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
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...

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.