471,348 Members | 1,524 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 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 5366

"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David Logan | last post: by
3 posts views Thread by colmag | last post: by
2 posts views Thread by Kishore | last post: by
7 posts views Thread by George | last post: by
5 posts views Thread by Richard | last post: by
reply views Thread by Manfred | last post: by
reply views Thread by Ronak mishra | last post: by

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.