psexec stalls when ran with Java -
i'm using psexec
, sc query state= all
print out of services on remote server. i'm wanting parse output of , have been trying use bufferedreader
this.
runtime rt = runtime.getruntime(); string line = null; process pr = null; pr = rt.exec("test.bat"); bufferedreader input = new bufferedreader(new inputstreamreader(pr.getinputstream())); while((line = input.readline()) != null) { system.out.println(line); }
test.bat
psexec \\server -u username -p password sc query state=
when run psexec \\server -u username -p password sc query state= all
command line window, this;
service_name: tomcat6 type : 10 win32_own_process state : 4 running win32_exit_code : 0 (0x0) service_exit_code : 0 (0x0) checkpoint : 0x0 wait_hint : 0x0 service_name: activemq type : 10 win32_own_process state : 4 running win32_exit_code : 0 (0x0) service_exit_code : 0 (0x0) checkpoint : 0x0 wait_hint : 0x0 etc.
but in java, prints first service , stops, print out this;
service_name: tomcat6 type : 10 win32_own_process state : 4 running win32_exit_code : 0 (0x0) service_exit_code : 0 (0x0) checkpoint : 0x0 wait_hint : 0x0
there seems issue in using psexec java. switched paexec , worked fine.
Comments
Post a Comment