2013-09-25 32 views

回答

0

你的意思是这样

import java.io.*; 
    public class taskmanager { 

      public static void main(String[] args) throws IOException { 
       String line; 
       Process p = Runtime.getRuntime().exec("tasklist.exe"); 
       BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); 
       while ((line = input.readLine()) != null) { 
        System.out.println(line); //<-- Parse data here. 
        // new lines from here 
         String searchPath = "where notepad.exe"; 
         searchProcessPath(searchPath); 
       } 
       input.close(); 
      } 
public static void searchProcessPath(String processName) throws IOException 
     { 
      Runtime.getRuntime().exec(processName); 
     } 
     } 
+0

我得到的进程名,ID,seesionname,...但我需要一个过程的实际文件位置。 – Dineshkumar

+0

@Dineshkumar:你在考虑windows 2003及以上版本吗? –

+0

是的,尤其是windows8 – Dineshkumar

相关问题