类 ExecuteCmdUtil

java.lang.Object
tech.mhuang.pacebox.core.util.ExecuteCmdUtil

public class ExecuteCmdUtil extends Object
执行cmd命令工具
从以下版本开始:
1.0.9
作者:
yuanhang.huang
  • 字段详细资料

    • OS_NAME

      public static final String OS_NAME
      当前系统
    • WIN_CMD_CHCP_EN

      public static final String WIN_CMD_CHCP_EN
      win cmd 设置语言为
      另请参阅:
    • CMD_NOT_FOUND_MAP

      public static final Map<String,String> CMD_NOT_FOUND_MAP
      cmd not found 的关键字map
    • CMD_NOT_FOUND

      public static final String CMD_NOT_FOUND
      cmd not found 的关键字
      另请参阅:
  • 构造器详细资料

    • ExecuteCmdUtil

      public ExecuteCmdUtil()
  • 方法详细资料

    • executeCmdSingle

      public static boolean executeCmdSingle(String cmd) throws IOException, InterruptedException
      执行简单的命令
      参数:
      cmd - 命令
      返回:
      是否执行成功
      抛出:
      IOException - IOException
      InterruptedException - InterruptedException
    • executeCmdProcess

      public static Process executeCmdProcess(String cmd) throws IOException
      执行命令,返回执行的线程
      参数:
      cmd - 命令
      返回:
      Process
      抛出:
      IOException - IOException
    • processOutput

      public static String processOutput(Process ps) throws IOException
      执行线程输出的信息
      参数:
      ps - 执行线程
      返回:
      String 线程输出的信息
      抛出:
      IOException - IOException
    • processErrOutput

      public static String processErrOutput(Process ps) throws IOException
      执行线程输出的错误信息
      参数:
      ps - 执行线程
      返回:
      String 线程输出的错误信息
      抛出:
      IOException - IOException
    • processInput

      public static void processInput(Process ps, String input) throws IOException
      向执行线程中输入信息
      参数:
      ps - 执行线程
      input - 输入命令
      抛出:
      IOException - IOException
    • processWaitForAndDestroy

      public static boolean processWaitForAndDestroy(Process ps) throws InterruptedException
      等待执行线程完毕并返回状态,执行失败自动关闭线程
      参数:
      ps - 执行线程
      返回:
      线程执行是否成功
      抛出:
      InterruptedException - InterruptedException
    • processWaitFor

      public static boolean processWaitFor(Process ps) throws InterruptedException
      等待执行线程完毕并返回状态
      参数:
      ps - 执行线程
      返回:
      线程执行是否成功
      抛出:
      InterruptedException - InterruptedException
    • checkPrintNotFound

      public static void checkPrintNotFound(String print)
      检查命令输出的打印中是否有not found
      参数:
      print - 字符串