powercfg in java program no error no output -
powercfg in java programme no error no output, when run not shows output
import java.net.*; import java.io.*; public class ip{ public static void main(string args[]) throws ioexception{ try{ string inputline; runtime r=runtime.getruntime(); process p=r.exec("cmd.exe /c powercfg/batteryreport"); bufferedreader in=new bufferedreader(new inputstreamreader(p.getinputstream())); while ((inputline = in.readline()) != null) { system.out.println(inputline); //pingresult += inputline; } } catch(exception e){ system.out.println(e); } } }
this because @ to the lowest degree on windows 7, if seek run powercfg/batteryreport cmd, "invalid parameters -- seek "/?" help", if not on laptop. see message java should attach p.geterrorstream()
try 'powercfg -energy', example
java
No comments:
Post a Comment