Package com.kun.util;
Import Java.io.BufferedReader;
Import Java.io.InputStreamReader;
public class Testospath {static process process;
public static void Main (string[] args) {
try {
string[] cmd = new string[] {"cmd.exe", "/C", "Path"};
Process = Runtime.getruntime (). exec (CMD);
InputStreamReader ir = new InputStreamReader (process
. getInputStream ());
BufferedReader br = new BufferedReader (IR);
String Line;
String path= "";
while (line = Br.readline ())!= null) {
Path+=line;
}
SYSTEM.OUT.PRINTLN (path);
Path=path.substring (path.indexof ("=") +1). toLowerCase ();
String[] Temp=path.split (";");
for (int i=0;i<temp.length;i++) {
if (Temp[i].indexof ("Windows")!=-1) {
Path=path.substring (0,temp[i].indexof (":"));
Break
}
}
SYSTEM.OUT.PRINTLN (path);
}
catch (java.io.IOException e) {
System.err.println ("ioexception " + e.getmessage ());
e.printstacktrace ();
}
}
}