Java exec execCmdWindows(String cmd)

Here you can find the source of execCmdWindows(String cmd)

Description

exec Cmd Windows

License

Open Source License

Declaration

public static String execCmdWindows(String cmd) throws java.io.IOException 

Method Source Code

//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
}

Related

  1. execAndGetOutput(ProcessBuilder builder)
  2. execCmd(String cmd)
  3. execCmd(String cmd)
  4. execCmd(String cmd, File where)
  5. execCmd(String command)
  6. execCommand(String cmd)
  7. execCommand(String command)
  8. execCommand(String command)
  9. execCommand(String[] cmd)