473,503 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows App Command Line

Hey all,
I have a windows application that I need to pass command line
arguments to. However I can't get it to work. Does anyone have any
example on how to do this. I can get it to work on a consol app, not a
windows one like I need though. .net 2.0 c#...

Thanks for the help

Aug 2 '06 #1
3 2033
Hi,
You need to change the signature static void Main() to static void
Main(string[] args).
You could find this function in Program.cs. All the command line parameters
separated with spaces will be populated in the args array.

--
Tariq Karim
IITMConsulting (http://www.IITMConsulting.com)

"Red2" <sd******@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
Hey all,
I have a windows application that I need to pass command line
arguments to. However I can't get it to work. Does anyone have any
example on how to do this. I can get it to work on a consol app, not a
windows one like I need though. .net 2.0 c#...

Thanks for the help

Aug 2 '06 #2
Hi,
Here is the code that maybe helpful

Process cscPro=new Process();
cscPro.StartInfo.FileName = "csc.exe";
cscPro.StartInfo.WorkingDirectory = Path;
cscPro.StartInfo.Arguments = codeFileName;
cscPro.StartInfo.CreateNoWindow = true;
cscPro.StartInfo.UseShellExecute = false; //don't use shell,
then we can redirect the input and output of the exe
cscPro.StartInfo.RedirectStandardInput = true;
cscPro.StartInfo.RedirectStandardOutput = true;
cscPro.StartInfo.RedirectStandardError = true;
cscPro.Start();
cscPro.StandardInput.WriteLine("xxx"); //send parameters to
the exe
string outPut = cscPro.StandardOutput.ReadToEnd(); //get the
output
"Red2" wrote:
Hey all,
I have a windows application that I need to pass command line
arguments to. However I can't get it to work. Does anyone have any
example on how to do this. I can get it to work on a consol app, not a
windows one like I need though. .net 2.0 c#...

Thanks for the help

Aug 2 '06 #3
Thanks for all your help
shrinerain wrote:
Hi,
Here is the code that maybe helpful

Process cscPro=new Process();
cscPro.StartInfo.FileName = "csc.exe";
cscPro.StartInfo.WorkingDirectory = Path;
cscPro.StartInfo.Arguments = codeFileName;
cscPro.StartInfo.CreateNoWindow = true;
cscPro.StartInfo.UseShellExecute = false; //don't use shell,
then we can redirect the input and output of the exe
cscPro.StartInfo.RedirectStandardInput = true;
cscPro.StartInfo.RedirectStandardOutput = true;
cscPro.StartInfo.RedirectStandardError = true;
cscPro.Start();
cscPro.StandardInput.WriteLine("xxx"); //send parameters to
the exe
string outPut = cscPro.StandardOutput.ReadToEnd(); //get the
output
"Red2" wrote:
Hey all,
I have a windows application that I need to pass command line
arguments to. However I can't get it to work. Does anyone have any
example on how to do this. I can get it to work on a consol app, not a
windows one like I need though. .net 2.0 c#...

Thanks for the help
Aug 3 '06 #4

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

Similar topics

2
15206
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
0
2414
by: Tom Dacon | last post by:
"Open .Net Command Window Here" context menu for Windows Explorer: The reg file described below adds a new menu item to Windows Explorer's context menu when you right-click over a folder (or the...
7
4715
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
14
2016
by: Kenneth McDonald | last post by:
At the moment I'm doing most of my stuff on a Mac, but I've been considering also getting a Windows laptop. One of the reasons is that I've found it very difficult to get certain Python related...
7
2566
by: John F | last post by:
Not exactly a C question (sorry), but I couldn't find a ng that seems more suitable... On the Unix shell command line I can successfully write cc -DPATH=\"abcd/\" program.c -o program to...
4
14035
by: reachsamdurai | last post by:
Hello, Can you please let me know the procedure to reach db2 command prompt from a cygwin window (hence without using Start-> Run -> db2cmd method). I'm planning to write shell scripts which...
7
9333
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
13
4177
by: rufus | last post by:
Is there a C++ compiler for windows that can be run from the commmandline? I have only be able to find MS Visual Studio but its rather overkill since I also like to just use notepad for my code.
0
30176
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
0
7207
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
7093
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
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7012
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
7468
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
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.