[英].NET Console app command line parsing of file arguments
I am doing a command line app that needs to read some files and do some processing. 我正在做一个需要读取一些文件并进行一些处理的命令行应用程序。
There can be many file arguments on the command line, and each of these can be in one of the following formats: 命令行上可以有许多文件参数,每个参数都可以采用以下格式之一:
Network shares should be supported. 应支持网络共享。
What is the easiest way to get a collection of all the files matching the command line arguments ? 获取与命令行参数匹配的所有文件的集合的最简单方法是什么?
Examples of command lines that should be supported: 应支持的命令行示例:
tool.exe myfile.dat
tool.exe myfile.*
tool.exe ..\..\*.*
tool.exe C:\Temp\test.*
tool.exe \\server\share\*.dat
Is there nothing built-in in the framework to do this ? 框架中没有内置任何内容来执行此操作吗?
This question has a couple of good code samples and some discussion. 这个问题有几个很好的代码示例和一些讨论。 Here is another article that explains it and the code is a little simpler. 这是另一篇解释它的文章 ,代码更简单一些。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.