package com.iflytek.op;
import java.io.IOException;
public class Computer {
/**
* 浣跨敤榛樿娴忚鍣ㄦ墦寮€鎸囧畾缃戦〉
*
* @param url
* 瑕佹墦寮€鐨勭綉椤靛湴鍧€
*/
public static void browser(String url) {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("cmd /c start " + url);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 鍦ㄥ欢杩熸寚瀹氱殑绉掓暟鍚庡叧鏈?
*
* @param sec
* 鍏虫満寤惰繜锛屽崟浣嶏細绉?
*/
public static void shutdown(int sec) {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("shutdown.exe -s -t " + sec);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 杩愯鎸囧畾璺緞鐨勭▼搴?
*
* @param exePath
* exe绋嬪簭鐨勮矾寰?
*/
public static void execute(String exePath) {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(exePath);
} catch (IOException e) {
e.printStackTrace();
}
}
}