public static void openWinExe(String str) throws Exception {
StringBuilder sb = new StringBuilder();
String strCommand = "cmd /c start ";
sb.append(strCommand).append(str);
String ExePath = sb.toString();
Runtime runT = Runtime.getRuntime();
Process p = null;
try {
// String command="cmd /c start ";
p = runT.exec(ExePath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("loader .exe error.......");
}
}
public static void main(String[] args)
{
//举例
Test.openWinExe("QQ.exe");
Test.openWinExe("wmic process where name='QQ.exe' call terminate");
}
StringBuilder sb = new StringBuilder();
String strCommand = "cmd /c start ";
sb.append(strCommand).append(str);
String ExePath = sb.toString();
Runtime runT = Runtime.getRuntime();
Process p = null;
try {
// String command="cmd /c start ";
p = runT.exec(ExePath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("loader .exe error.......");
}
}
public static void main(String[] args)
{
//举例
Test.openWinExe("QQ.exe");
Test.openWinExe("wmic process where name='QQ.exe' call terminate");
}