控制用户输入arguments
自己写一个console程序,用户可以输入一些参数。
但是在用户输入的参数里面要进行控制,
比如,你打开个cmd窗口, copy /? 回车。
===============它会出现:=================
Copies one or more files to another location.
COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
======================================
类似这样,用户只能输入/y 或者/-y ,二者不能同时出现。
问题来了:怎样控制args,才能保证二者/Y /-Y同时出现是错误的,出现一个或一个都不出现是正确的。