GeneralCommandLine (@NotNull String exePath, @NotNull String parametersTemplate, @NotNull Map<String, String> patterns) { List<String> parameters = ParametersListUtil.parse(parametersTemplate, true); List<String> from = new ArrayList<>(); List<String> to = new ArrayList<>(); for (Map.Entry<String, String> entry : patterns.entrySet()) { from.add(entry.getKey()); to.add(entry.getValue()); } List<String> args = new ArrayList<>(); for (String parameter : parameters) { String arg = StringUtil.replace(parameter, from, to); if (!StringUtil.isEmptyOrSpaces(arg)) args.add(arg); } GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(exePath); commandLine.addParameters(args); return commandLine; }