code: private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) {
      StringBuilder cmdline = new StringBuilder();
      for (Map.Entry<String, String> e : childEnv.entrySet()) {
        cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue()));
        cmdline.append(" && ");
      }
      for (String arg : cmd) {
        cmdline.append(quoteForBatchScript(arg));
        cmdline.append(" ");
      }
      return cmdline.toString();
    }
docs: Prepare a command line for execution from a Windows batch script.
  
  The method quotes all arguments so that spaces are handled as expected. Quotes within arguments
  are "double quoted" (which is batch for escaping a quote). This page has more details about
  quoting and other batch script fun stuff: http://ss64.com/nt/syntax-esc.html