开发者

Console Application input parameters - string identification

I have a console app that takes in string parameters. The app runs through the command line like so:

C:\ExampleApp.exe this is a "test"

In the above example, there are 4 different strings read in as paramet开发者_开发问答ers.. Is there any way to determine which parameter had quotes around it? When I do a Console.WriteLine(args[3]), it prints out as test and not "test".


Environment.CommandLine returns a complete command line as a single string, just parse it and you will get the original parameters, quoted or not.


As far as I know the quotes are stripped by the framework before beeing passed to your main function, have you tried to escape the qoutes using a backslash?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜