这是用于将文件添加到队列的unix命令。
enq -P QueueName:PrinterName FileName
是否可以使用Java运行上述命令。
最佳答案
是的,可以使用ProcessBuilder:
ProcessBuilder builder =
new ProcessBuilder("enq", "-P", "QueueName", "FileName");
Process process = builder.start();
InputStreamReader streamReader = new InputStreamReader(process.getInputStream());
BufferedReader reader = new BufferedReader(streamReader);
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
另请:enq syntax