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

command line arguments not recognized

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

Dec 4 '06 #1
2 2588
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" <go*********@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
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

Dec 4 '06 #2
Yes user should do this:

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

chanmm

"gopal" <go*********@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
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
Dec 4 '06 #3

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

Similar topics

6
by: Hari | last post by:
can i have command line arguments in VS.NET applicatio? if yes how? Can i have some code snippets of the above functionality? I know we can acjieve this in console application form command...
2
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain...
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
1
by: Rune Jacobsen | last post by:
Hi, I've been trying to figure this one out, but my experience just doesn't have what it takes... :| I am writing an application that reads an XML file and displays the contents in various...
7
by: mackmelo | last post by:
Hi, I'm trying to create a program that reads these two characters (& and ^) as arguments to a funcion. However since they are part of the operational system characters with special funcions...
40
by: raphfrk | last post by:
I have a program which reads in 3 filenames from the command line prog filename1 filename2 filename3 However, it doesn't work when one of the filenames has spaces in it (due to a directory...
2
by: Milan | last post by:
Hi, Please guide me how to set command line argument and how to retrive command line argument. Senario: vb.net application should be able to execute from command prompt by passing login and...
7
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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...

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.