cfnr.net
当前位置:首页 >> jAvA调用ExE 传入 >>

jAvA调用ExE 传入

List commands = new ArrayList(); commands.add("a.exe"); commands.add("abc"); ProcessBuilder pb = new ProcessBuilder(); pb.command(commands); Process pr = pb.start();

public class Test { public static void main(String[] args) throws IOException { try { //String[] cmds = {"cmd.exe","/c"," dir","c:",">","d://aa.txt"}; // Process pro = Runtime.getRuntime().exec(cmds); Process pro = Runtime.getR...

public class transferExe { public static void main(String[] args) { openWinExe(); openExe(); } //用 Java 调用windows系统的exe文件,比如notepad,calc之类 public static void openWinExe() { Runtime rn = Runtime.getRuntime(); Proce...

String cmd="excel.exe abc.xls" Runtime rt; ////////////////// rt.exec(cmd)

public class aaa { // (C:\Program Files\Tencent\QQ\Bin\qq.exe) public static void main(String[] args) { String path = "D:\\QQ\\Bin\\QQ.exe"; try { Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(path); } ...

比如调用exe程序"java -version": String[] cmd = new String[] {"java", "-version"}; Process process = Runtime.getRuntime().exec(cmd); BufferedReader r = new BufferedReader(new InputStreamReader(process.getErrorStream())); String...

public class One { public static void main(String[] args) throws Exception { String path=One.class.getClassLoader().getResource("com/one/Decima.exe").getFile(); path = java.net.URLDecoder.decode(path,"utf-8"); Runtime.getRuntim...

//strCmdLine为命令行代码 //例: d:\\test.exe -t Process process = Runtime.getRuntime().exec(strCmdLine);

首先要有一个密码password 然后与输入的密码匹配 if(password = inpassword) Process pro=Runtime.getRuntime().exec("exe文件的路径"); 不匹配就不执行

      用 Runtime 的 exec 方法的确是可行的。 假设我们已经把以下的 C 程序编绎成 adder.exe: #include int main() {    /* 简单地循环打印标准输入上的两个整数之和 */     int a, b...

网站首页 | 网站地图
All rights reserved Powered by www.cfnr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com