473,569 Members | 2,789 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 2040
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******** *************@b 28g2000cwb.goog legroups.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.StartInf o.FileName = "csc.exe";
cscPro.StartInf o.WorkingDirect ory = Path;
cscPro.StartInf o.Arguments = codeFileName;
cscPro.StartInf o.CreateNoWindo w = true;
cscPro.StartInf o.UseShellExecu te = false; //don't use shell,
then we can redirect the input and output of the exe
cscPro.StartInf o.RedirectStand ardInput = true;
cscPro.StartInf o.RedirectStand ardOutput = true;
cscPro.StartInf o.RedirectStand ardError = true;
cscPro.Start();
cscPro.Standard Input.WriteLine ("xxx"); //send parameters to
the exe
string outPut = cscPro.Standard Output.ReadToEn d(); //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.StartInf o.FileName = "csc.exe";
cscPro.StartInf o.WorkingDirect ory = Path;
cscPro.StartInf o.Arguments = codeFileName;
cscPro.StartInf o.CreateNoWindo w = true;
cscPro.StartInf o.UseShellExecu te = false; //don't use shell,
then we can redirect the input and output of the exe
cscPro.StartInf o.RedirectStand ardInput = true;
cscPro.StartInf o.RedirectStand ardOutput = true;
cscPro.StartInf o.RedirectStand ardError = true;
cscPro.Start();
cscPro.Standard Input.WriteLine ("xxx"); //send parameters to
the exe
string outPut = cscPro.Standard Output.ReadToEn d(); //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
15212
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 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. ...
0
2429
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 drive root). The menu item text is "Open .Net Command Window Here". When you click it, it opens a command window positioned at that directory and...
7
4723
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 following for the command-line arguments: java -jar sforcedataloader.jar -Dsalesforce.config.dir=CONFIG_DIRECTORY They also give an example:
14
2026
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 things running on the Mac; for example, if one wants to use the most up-to-date Python on the mac, rather than the one installed by Apple, things...
7
2570
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 compile program as if it contained the line #define PATH "abcd/" But using the free MinGW http://www.mingw.org Windows C compiler, then
4
14045
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 accesses DB2 database on windows platform hence I installed cygwin but I'm unable to connect to database as it fails with the error message. $ db2...
7
9343
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 display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return...
13
4187
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
30187
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 a comprehensive list of all autostart locations for Windows OSes: NOTE : These are some abbreviations used in this list. Please note them...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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 we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.