Here you can find the source of execCmdWindows(String cmd)
public static String execCmdWindows(String cmd) throws java.io.IOException
//package com.java2s; //License from project: Open Source License public class Main { public static String execCmdWindows(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner( Runtime.getRuntime().exec(String.format("cmd /c %s", cmd)).getInputStream()).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; }// ww w . ja va 2 s . c om }