2022
02-24
02-24
Java中如何执行多条shell/bat命令
java调用process执行命令publicclassShellUtil{publicstaticStringrunShell(StringshStr)throwsException{Processprocess;process=Runtime.getRuntime().exec(newString[]{"/bin/sh","-c",shStr});process.waitFor();BufferedReaderread=newBufferedReader(newInputStreamReader(process.getInputStream()));Stringline=null;Stringresult=...
继续阅读 >