在java
For a robust and feature-rich solution, consider using the following libraries:
Apache Commons CLI: http://commons.apache.org/cli/
JSAP: http://www.martiansoftware.com/jsap/ 如果您喜歡滾動解決方案,則可以利用java api gread read Input grogmounts from scanner類, http://docs.oracle.com/javase/7/docs/api/java/java/util/scanner.html args)拋出異常{ 選項選項= new Options(); 選項輸入=新選項(“ i”,“ input”,true,“輸入文件路徑”); input.setRequired(true); options.addoption(輸入); 選項輸出=新選項(“ o”,“ output”,true,“輸出文件”); output.setRequired(true); options.addoption(輸出); CommandLineParser parser = new DefaultParser(); helpformatter formatter = new helpformatter(); commandline cmd = parser.parse(options,args); 字符串inputfilepath = cmd.getOptionValue(“ input”); 字符串outputFilePath = cmd.getOptionValue(“ output”); System.out.println(InputFilePath); system.out.println(outputFilePath); } }
命令行usage:您可以以下面的方式執行程序:
免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。
Copyright© 2022 湘ICP备2022001581号-3