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

Invoke a .Net Console Application

Hi,
I have a small console application written in c# that takes two
arguments.
I am using
System.Diagnostics.Process.Start("cmdApp.exe", arguments)
to start the application from another .net application.

But I am unable to start the console application using this method.
When I write a batch file (app.Bat) like:
cmdApp.exe %1 %2
and invoke the batch file from the other application using
System.Diagnostics.Process.Start("app.bat", arguments)
I am able to invoke the console application.

I think this is because a .net application needs mscoree.dll (.Net
execution engine) to execute it.
Is there a way to invoke the .net execution engine and pass the name
of the application as a parameter to it?

How can I invoke the console application from a Win32 application?

Thanks in advance...
Kishore.

Jul 21 '05 #1
2 5500

"Kishore" <ac****@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Hi,
I have a small console application written in c# that takes two
arguments.
I am using
System.Diagnostics.Process.Start("cmdApp.exe", arguments)
to start the application from another .net application.

But I am unable to start the console application using this method.
What happens?
When I write a batch file (app.Bat) like:
cmdApp.exe %1 %2
and invoke the batch file from the other application using
System.Diagnostics.Process.Start("app.bat", arguments)
I am able to invoke the console application.

I think this is because a .net application needs mscoree.dll (.Net
execution engine) to execute it.
Is there a way to invoke the .net execution engine and pass the name
of the application as a parameter to it?


That shouldn't be necessary. If your computer has .NET Framework on it,
your original method should work (although admittedly I haven't tried it).
As far as Windows is concerned, cmdApp.exe is an executable file which calls
mscoree.dll and other DLLs. It loads just like any other .exe, and then
gets involved with .NET stuff when it starts running.

I'm guessing the problem is something entirely different. However, here is
something else to try:

System.Diagnostics.Process.Start("cmd.exe","/c myapp.exe")

(that is probably not the right way to do the arguments, but you know what I
mean). This should do what the BAT does, but without a BAT file.
Jul 21 '05 #2
Hi Mr. Covington
Your solution works great.
System.Diagnostics.Process.Start("cmd.exe","/c myapp.exe") <<


Thanks,
Kishore.

Jul 21 '05 #3

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

Similar topics

2
by: Vinay | last post by:
Hi , I am having server and client. Client is a test machine. I want to invoke the application binary which resides on server from client machine. The binary is created using C#. Please note that...
3
by: David Logan | last post by:
I have an application using sockets, and it uses the asynchronous method for receiving (and others, but receiving is the basic problem.) In short, I want: class someClass: Form {...
2
by: Jacek | last post by:
Hello! My application has to use external native library writing to stdout and stdin. My goal is to redirect output within running process (no chance to do that in child process - Process class...
2
by: russb_69 | last post by:
Russ here. I'm new to this forum. I need help in understanding why the following code does not work. Basically, I'm defining a structure in a c# application, and using a c++ dll to modify it. ...
3
by: colmag | last post by:
I read in a previous post by Tom Shelton that you can call AllocConsole via p/invoke to allocate a console window to a form application. I've searched for info on how to do this, but have drawn a...
2
by: Kishore | last post by:
Hi, I have a small console application written in c# that takes two arguments. I am using System.Diagnostics.Process.Start("cmdApp.exe", arguments) to start the application from another .net...
7
by: George | last post by:
Hi, Does anyone know how Control.Invoke can invoke a method which has ref parameters? For example, class A { public delegate MyFuncHandler(ref int i, ref int j);
5
by: Richard | last post by:
Hello, I'm working on an application to allow our network team to use a small application to make DHCP reservations on our Microsoft DHCP Server. The problem is you have to use P/Invoke to do...
0
by: Manfred | last post by:
Hello I'm new to VB.Net and try to create a console applicatione which will redirect the output to an arraylist. I found a very good sample at:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.