command line arguments strange behaviour

O

Oleg Medyanik

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

Run it with the following param

ConsoleApplication1.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?
ConsoleApplication1.exe test^^^^
produces the following output : test^^

Thank you.
 
M

Mattias Sjögren

Oleg,
Is ^ char used in splits?

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 >.

ConsoleApplication1.exe test$^>

should print

test$>



Mattias
 
O

Oleg Medyanik

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.ParseCommandLine (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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top