PC Review


Reply
Thread Tools Rate Thread

command line arguments not recognized

 
 
gopal
Guest
Posts: n/a
 
      4th Dec 2006
static void Main(string[] args)
{
....
....
}


I have an EXE now. I am now giving one of the arguments

as

> EXE C:\Documents and Settings\121308\Desktop\First.xml.


The problem is i am not able to parse the XML file. I am getting the
message at command line as

'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.

How can read a file from a folder which has spaces in the folder name
itself like the one
mentioned above as Documents and settings.

Should user give the arguments with in Quotes/ or is there any other
smart way


Thanks
JP

 
Reply With Quote
 
 
 
 
Dave Shooter
Guest
Posts: n/a
 
      4th Dec 2006
Most applications expect the arguments in quotes, though you could
concatenate them back into a single string (including spaces).

static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < args.Length; i++)
{
sb.Append(args[i]);
if (i < args.Length - 1)
{
sb.Append(" ");
}
}
Console.Out.WriteLine(sb.ToString());
}



"gopal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> static void Main(string[] args)
> {
> ....
> ....
> }
>
>
> I have an EXE now. I am now giving one of the arguments
>
> as
>
>> EXE C:\Documents and Settings\121308\Desktop\First.xml.

>
> The problem is i am not able to parse the XML file. I am getting the
> message at command line as
>
> 'C:\Documents' is not recognized as an internal or external command,
> operable program or batch file.
>
> How can read a file from a folder which has spaces in the folder name
> itself like the one
> mentioned above as Documents and settings.
>
> Should user give the arguments with in Quotes/ or is there any other
> smart way
>
>
> Thanks
> JP
>



 
Reply With Quote
 
Chan Ming Man
Guest
Posts: n/a
 
      4th Dec 2006
Yes user should do this:

"C:\Documents and Settings\121308\Desktop\First.xml"

chanmm

"gopal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> static void Main(string[] args)
> {
> ....
> ....
> }
>
>
> I have an EXE now. I am now giving one of the arguments
>
> as
>
>> EXE C:\Documents and Settings\121308\Desktop\First.xml.

>
> The problem is i am not able to parse the XML file. I am getting the
> message at command line as
>
> 'C:\Documents' is not recognized as an internal or external command,
> operable program or batch file.
>
> How can read a file from a folder which has spaces in the folder name
> itself like the one
> mentioned above as Documents and settings.
>
> Should user give the arguments with in Quotes/ or is there any other
> smart way
>
>
> Thanks
> JP
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
command line arguments ioanamirela Microsoft VC .NET 1 11th Mar 2005 01:45 AM
Command Line Arguments Eric Dreksler Microsoft Access External Data 6 5th May 2004 10:33 PM
Command line arguments Paolo Nunberg Microsoft Word Document Management 4 27th Feb 2004 11:36 PM
Command Line Arguments for a Non Command Line Program? CMG Microsoft VB .NET 6 30th Dec 2003 10:51 PM
command line arguments =?Utf-8?B?Q29saW4gQ29hZHk=?= Microsoft Outlook Discussion 3 18th Nov 2003 10:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:52 PM.