import java.io.*; public class dd { public static void main(String[] args) { try { Process pro = Runtime.getRuntime().exec( "cmd.exe /c tasklist |find \"1.exe\""); BufferedReader reader=new BufferedReader(new InputStreamReader(pro.getInputStream())); String str=reader.readLine(); if (str!=null) { System.out.println("1.exe在运行"); }else{ System.out.println("1.exe没有在运行"); } reader.close(); } catch (IOException ex) { } } }
时间: 2024-10-22 00:30:06