正在向 windows 控制台发送命令确认
Sending command confirmation to windows console
我已经成功地从 java 调用了 Windows 控制台来使用 zlib 解压缩一个字符串,如下所示:
Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c start z -d psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
在此之后,我被问到是否要覆盖文件,我必须表示是,但在执行命令后,我也不知道如何从 java 执行此操作。
我该怎么做?
谢谢
您可以像这样响应控制台提示:
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cmd.exe /c start z -d psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
new PrintWriter(proc.getOutputStream()).println("y");
我找到了如何使用 -r 命令解决它
rt.exec("cmd.exe /c start z -d -r psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
这样我就替换了文件而不问我是否想要
我已经成功地从 java 调用了 Windows 控制台来使用 zlib 解压缩一个字符串,如下所示:
Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c start z -d psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
在此之后,我被问到是否要覆盖文件,我必须表示是,但在执行命令后,我也不知道如何从 java 执行此操作。
我该怎么做?
谢谢
您可以像这样响应控制台提示:
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cmd.exe /c start z -d psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
new PrintWriter(proc.getOutputStream()).println("y");
我找到了如何使用 -r 命令解决它
rt.exec("cmd.exe /c start z -d -r psw.txt", null, new File("C:\users\dlopez\Encrypted\ "));
这样我就替换了文件而不问我是否想要