Java exec execCmd(String cmd, File where)

Here you can find the source of execCmd(String cmd, File where)

Description

exec Cmd

License

Open Source License

Declaration

public static String execCmd(String cmd, File where) throws Exception 

Method Source Code


//package com.java2s;
import java.io.File;

import java.util.Scanner;

public class Main {
    public static String execCmd(String cmd, File where) throws Exception {

        Process p = Runtime.getRuntime().exec(cmd, null, where);

        Scanner s = new Scanner(p.getInputStream());

        String ret = "";
        s.useDelimiter("\\A");
        if (s.hasNext())
            ret = s.next();/*  w w  w. j a  va2s  .com*/
        s.close();
        return ret;
    }
}

Related

  1. exec(String[] args)
  2. execAdbCmd(String cmd)
  3. execAndGetOutput(ProcessBuilder builder)
  4. execCmd(String cmd)
  5. execCmd(String cmd)
  6. execCmd(String command)
  7. execCmdWindows(String cmd)
  8. execCommand(String cmd)
  9. execCommand(String command)