473,383 Members | 1,980 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,383 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 5502

"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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.