package com.vipul; import java.applet.Applet; import java.awt.Checkbox; import java.awt.Choice; import java.awt.Font; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class BatchExecuteService extends Applet { public Choice choice; public void init() { setFont(new Font("Helvetica", Font.BOLD, 36)); choice = new Choice(); } public static void main(String[] args) { BatchExecuteService batchExecuteService = new BatchExecuteService(); batchExecuteService.run(); } List<String> processList = new ArrayList<String>(); public void run() { try { Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("D:\\server.bat"); process.getOutputStream().close(); InputStream inputStream = process.getInputStream(); InputStreamReader inputstreamreader = new InputStreamReader( inputStream); BufferedReader bufferedrReader = new BufferedReader( inputstreamreader); BufferedReader bufferedrReader1 = new BufferedReader( inputstreamreader); String strLine = ""; String x[]=new String[100]; int i=0; int t=0; while ((strLine = bufferedrReader.readLine()) != null) {
you can create a batch file for example
TASKLIST / v / FI "STATUS eq running" / FO "CSV" / FI "Username eq LHPL002 \ soft" / FI "MEMUSAGE gt 10000" / FI "Windowtitle ne N / A" / NH
Panchotiya Vipul May 30 '13 at 5:17 2013-05-30 05:17
source share