472,995 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,995 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 5481

"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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.