Skip to content

Instantly share code, notes, and snippets.

@mekefly
Created October 20, 2022 05:08
Show Gist options
  • Save mekefly/a7900887d97411a129274e623a1e3976 to your computer and use it in GitHub Desktop.
Save mekefly/a7900887d97411a129274e623a1e3976 to your computer and use it in GitHub Desktop.
CmdSilenceReturn.md

🧲 相关:

🗓️ 创建日期: [[2022-10-20#13:05]]


概要

输入命令获取结果

xxxxStr := cmdSilenceReturn("echo xxxxxx")
; 变量里的内容为 xxxxxx

源码

cmdSilenceReturn(command){

  CMDReturn:=""

  cmdFN:="RunAnyCtrlCMD"

  try{

    RunWait,% ComSpec " /C " command " > ""%Temp%\" cmdFN ".log""",, Hide

    FileRead, CMDReturn, %A_Temp%\%cmdFN%.log

    FileDelete,%A_Temp%\%cmdFN%.log

  }catch{}

  return CMDReturn

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment