command line arguments strange behaviour

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oleg Medyanik

    #1

    command line arguments strange behaviour

    Hi, i wonder if someone can explain the following...
    Create new Console application...
    static void Main(string[] args)
    {
    Console.WriteLi ne(args[0]);
    }

    Run it with the following param

    ConsoleApplicat ion1.exe test$^
    On my Win XP and NET 1.1 i receive the output: test$
    ^ disappears.

    Faced it first when worked with custom installer, then tried the simple
    program also parsing command line...
    Is ^ char used in splits?
    ConsoleApplicat ion1.exe test^^^^
    produces the following output : test^^

    Thank you.


  • Mattias Sjögren

    #2
    Re: command line arguments strange behaviour

    Oleg,
    [color=blue]
    >Is ^ char used in splits?[/color]

    No it's an escape character (sort of like \ in C# string literals).
    You can use it to escape otherwise special characters such as < and >.

    ConsoleApplicat ion1.exe test$^>

    should print

    test$>



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Oleg Medyanik

      #3
      Re: command line arguments strange behaviour

      Mattias - thank you for the explanation....

      All below are just thoughts.....

      As i already wrote, i faced this problem writing setup for the project....
      But in real, the situation was like that -

      Imagine, you add user dialog (TextBoxes A) to your setup project.
      Fields are used for DB Setup in your custom installer.....

      On installing user reports that DB login constantly fails.....
      I become very nervous because it was tested many times......

      As appears, InstallContext. ParseCommandLin e (where custom installer take the
      dialog field values from) also skips the literals )))
      So if user provides password "test^ " he is not able to login than .....

      As a sloution i wrote my own custom dialog called from the installer, but it
      this i think the situation is quite silly )))
      1. I can not use regular features provided by Setup Projects.
      2. I can not explain the customer that he can not use ^ character in his
      passwords..... )))

      _______________ _______________ _______________ _______________ ______

      Sincerely yours,
      Oleg Medyanik




      Comment

      Working...