How to give command to CMD from JAVA SWING programe(Print command to cmd from JAVA Swing)

时间:2016-10-20 18:41:03

标签: java swing printing cmd

I am making POS which have comport printer. I created one text file and I want to give to the printer. I know the cmd command(print data.txt /d:com2) but how to give this command to CMD using java program?

1 个答案:

答案 0 :(得分:0)

If you do not care about stdin/stdout, them just

Runtime.getRuntime().exec("print data.txt /d:com2").waitFor();