这是用于将文件添加到队列的unix命令。
enq -P QueueName:PrinterName FileName
是否可以使用java运行上述命令。
答案 0 :(得分:4)
是的,可以使用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
答案 1 :(得分:0)
Process p = Runtime.getRuntime().exec(new String[]{"enq", "-P", "QueueName:PrinterName FileName"});