需要启动PHP,APACHE,MYSQL使用UWAMP或任何后台进程而不显示托盘图标或任何?使用命令行启动-WindowStyle隐藏它不工作。请给我推荐一下这个的方法。
发布于 2018-06-26 06:06:18
使用命令提示符在windows中启动应用程序,几乎所有的编程语言都可以使用这个递归,我在java语言中使用这些命令:
//有关使用windows操作系统提示符中的命令的类
公共类提示{
public static String exec(String cmd) {
String resposta = "";
try {
Scanner S = new Scanner(Runtime.getRuntime().exec(cmd).getInputStream());
while (S.hasNextLine()) {
resposta += S.nextLine() + "\n";
}
} catch (Exception ex) {
Alert.error(ex.getMessage());
}
return resposta;
}
public static void open(String cmd) {
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException ex) {
Alert.error(ex.getMessage());
}
}}
//另一个类中的方法,用于启动程序,如服务
public static void start() {)
try {
String file = new File("").getAbsolutePath();
String startApache = file + "/UwAmp/bin/apache/bin/httpd.exe -k -start";
String startMySql = file + "/UwAmp/bin/database/mysql-5.7.11/bin/mysqld.exe";
System.out.println("beginning Apache Server");
Prompt.exec(startApache);
Thread.sleep(500);
System.out.println("beginning MySQL Database Server");
Prompt.exec(startMySql);
Thread.sleep(500);
} catch (Exception ex) {
Alert.error(ex.getMessage());
}
}
https://stackoverflow.com/questions/50617833
复制相似问题