package com.Cx_330.run;
import org.omg.SendingContext.RunTime;
import java.io.File;
import java.io.IOException;
public class test {
public static void main(String[] args) {
searchFile(new File("D:/"),"ChromeCore.exe");
}
public static void searchFile(File file,String name){
if(file!=null&&file.isDirectory()){
File[] files = file.listFiles();
if (files!=null&&files.length>0) {
for (File f : files) {
if (f.isFile()) {
if (f.getName().contains(name)) {
System.out.println("找到了.." + name);
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(f.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
searchFile(f, name);
}
}
}
}else {
System.out.println("文件为空,找不到...");
}
}
}
用IDEA打开你想启动的程序
最新推荐文章于 2022-09-17 16:19:18 发布