473,322 Members | 1,345 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,322 software developers and data experts.

'The Paramter is incorrect', running a console program

I'm trying to run a program and pass it arguments. I know that the arguments provided are correct but I get a "The Parameter is incorrect" error. I has used the exact same arguments as provided in the 'arg' string to the program on the console and it worked as expecterd. (I copied the text directly from a watch I had set up)

I am using C#. Is there anything that I have missed?

Thank you.
Expand|Select|Wrap|Line Numbers
  1.             System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
  2.             si.Arguments = arg;
  3.             si.CreateNoWindow = true;
  4.             si.FileName = ".\\planet.exe";
  5.             si.RedirectStandardOutput = true;
  6.             si.UseShellExecute = false;
  7.             try
  8.             {
  9.                 MessageBox.Show(si.FileName+ " "+si.Arguments);
  10.                 System.Diagnostics.Process prc=System.Diagnostics.Process.Start(si);
  11.                 prc.WaitForExit();
  12.             }
Oct 17 '06 #1
2 1778
bharathreddy
111 100+
hai gilllyo,

si.Arguments = arg;
// I think arg is an array
// We cant assign the array values to ProcessStartInfo.Arguments

This site can help you.

http://msdn2.microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments.aspx
Oct 17 '06 #2
"arg" isn't an array. Are you saying it should be or shouldn't be?

Expand|Select|Wrap|Line Numbers
  1. String arg = (String)e.Argument;
  2.  
That's the line of code that takes the argument passed to a worker thread that's responsible for running the program (ie, same function) and using it for the argument to be passed to the program.
Oct 17 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: limelight | last post by:
I have discovered a math error in the .NET framework's Log function. It returns incorrect results for varying powers of 2 that depend on whether the program is run from within the IDE or from the...
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...
0
by: Dmitry Bogdanov | last post by:
I have a problem - if I access the session in Web Service, as soon as I store anything in it, requests are no longer running in parallel - instead, they are queued and executed sequentially. Here...
32
by: Michael C | last post by:
I want to inherit from Bitmap to add a property but I can't because it's sealed. Is there any reason to seal a class? Thanks, Michael
5
by: =?Utf-8?B?RkxEYXZlTQ==?= | last post by:
I'm developing an application that gets data from 100 sources (via telnet connections, but you can think stock quotes from a webservice if you like). I was planning on using the thread pool (25...
3
by: MikeB | last post by:
Hello All, I have a console application that is run via a scheduled task everyday at 4 in the morning. For some reason, a couple of days ago, every time the scheduled task is run (ether...
6
by: DaTurk | last post by:
I know in a WinForm you can check if an Invoke is inquired and invoke a method on the main thread. But can you do this in a class? Can I call Invoke(someMethod) in my asynch event handler? And...
0
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.