473,748 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'The Paramter is incorrect', running a console program

2 New Member
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 1810
bharathreddy
111 New Member
hai gilllyo,

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

This site can help you.

http://msdn2.microsoft .com/en-us/library/system.diagnost ics.processstar tinfo.arguments .aspx
Oct 17 '06 #2
gilllyo
2 New Member
"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
2741
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 command line. The amount by which the calculation is off is very small; even though the double data type holds the errant value, it seems to round off when printed (via ToString()) and shows the correct one. The problem is that the errant value is...
2
4579
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 redirection is useless in that case) and I would like to do it without reverting to C-run time library P/Invoke calls. Any ideas how to do that?
0
1133
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 is an example (ASP.NET 2.0, VS 2005). Web service method (web service is a regular asmx):
32
9446
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
2567
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 at a time). I know I would start all 100 at once and as threads finish, a new thread would become available and the next one would start. However, I need to do this over and over (using an app that will run for days or longer). How can I tell...
3
3200
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 manually or by scheduled time) I get a "The surrogate pair is invalid" error. When ever I manually run the app by double clicking it, it runs fine. Any ideas what could be causing this error? It used to run fine previously and am pretty sure nothing...
6
2740
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 if I can't do it this way, is there a way I can do it? Thanks.
0
7334
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 beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who don't know how to use the IDE for best results. Visual Studio automatically creates a number of...
2
20849
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 some of the tools provided on the command-line. If you hate the command line tools, get over it since you’re bound to be using them at some point in your career. All commands in Linux ARE case sensitive so capital letters are different from lowercase...
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
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
3
2217
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.