import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer;
public class ExecuteShellCommand implements RemoteAccess{
public static void main(String[] args) throws Exception {
RemoteMethodServer rms = RemoteMethodServer.getDefault();
rms.invoke("doshell", ExecuteShellCommand.class.getName(), null, new Class[] {}, new Object[] {});
}
/**
* Java调用windows的DOS,执行命令 。
*/
public static void doshell() {
InputStream ins = null;
String[] cmd0 = new String[] { "cmd.exe", "/K", "d:" }; // 命令
String[] cmd1 = new String[] { "cmd.exe", "/K", "cd ptc/Windchill/bin" };
String[] cmd2 = new String[] { "cmd.exe", "/K", "windchill shell" };
String[] cmd3 = new String[] { "cmd.exe", "/K", "cd ../deploy" };
String[] cmd4 = new Str
Java 用代码打开DOS并执行命令后关闭
最新推荐文章于 2021-07-06 09:56:19 发布