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 ( ) ; }
Prepare a command line for execution from a Windows batch script .