Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9176639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:09:00+00:00 2026-06-17T17:09:00+00:00

I wrote this console app that reads a sequence of command line arguments and

  • 0

I wrote this console app that reads a sequence of command line arguments and does something with them.

The problem is that if the user enters something like:

 --folder "C:\my folder\" --username john

the args String array of the Main function will have 2 elements rather than 4:

1st element: "--folder"
2nd element: "C:\my folder\" --username john"

(the \” sequence is escaped as a double quote.)

Since not using quotes would result in 5 elements…

--folder C:\my folder\ --username john

1st element: --folder
2nd element: C:\my
3rd element: folder\
4th element: --username
5th element: john

… what’s the best way to get around this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:09:01+00:00Added an answer on June 17, 2026 at 5:09 pm

    This is a consequence of the weird command line parsing rules on Windows. See here http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx. The command line should actually be: --folder "C:\my folder\\" --username john

    This is a user input error. You shouldn’t try to correct it code; just fail gracefully.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I wrote this simple console app to aid in my question asking. What
C# I have a console app that reads and writes a get/set list of
I have wrote this simple console app to test when we change the timezone
I wrote this program: #include <stdio.h> /*Part B Write a program that: defines an
I am using C# and a console app and I am using this script
Have a simple console app where user is asked for several values to input.
I have a Windows Forms app that is able to open up a console
I have a C# console app that I'm trying to create that processes all
Newbie question... I have a working console app that uses a shared unit I
I am attempting to write a node app that reads in a set of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.