我需要通过我的java代码安装.msi文件。有可能吗?或者可以通过spring boot来实现?
我的本地目录中有.msi文件。我需要写一个java代码来运行.msi文件,无论是通过windows脚本还是直接?
我可以在程序中动态创建和运行windows.bat文件吗?
我试着这样:嗨,我试着这样做:
String[] command=
{
"cmd"
};
String command1 = "msiexec /i “*Path of the installation.msi*\"";
Process p;
try {
p=Runtime.getRuntime().exec(command);
PrintWriter stdin = new PrintWriter(p.getOutputStream());
stdin.println(command1);
stdin.close();
p.waitFor();
}运行后,我在窗口对话框下面:

单击“确定”后,程序将终止。即使我给你
p=Runtime.getRuntime().exec(command1);那也是同样的问题!
请帮帮我!
发布于 2020-07-17 00:19:00
这是路径问题,命令是正确的。考虑到转义序列,我们必须给出这样的路径。
String command1 = "msiexec.exe /a \"C:\\Users\\{name}\\Downloads\\{.msi}\"";
Runtime.getRuntime().exec(command1);https://stackoverflow.com/questions/62922464
复制相似问题