forked from denolfe/AutoHotkeyBoilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunWaitOne.ahk
More file actions
26 lines (21 loc) · 712 Bytes
/
RunWaitOne.ahk
File metadata and controls
26 lines (21 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
; Reference/Created By:
; Unknown
; https://www.autohotkey.com/docs/commands/Run.htm#StdOut
; Func: RunWaitOne
; run a command and retrieve its output
; Parameters:
; Command - Command to be run and its output returned.
; Returns:
; Output from running command.
; Examples:
; > MsgBox % RunWaitOne("dir " A_ScriptDir)
; *Output:*
; > Dir Contents
RunWaitOne(command) {
; WshShell object: http://msdn.microsoft.com/en-us/library/aew9yb99
shell := ComObjCreate("WScript.Shell")
; Execute a single command via cmd.exe
exec := shell.Exec(ComSpec " /C " command)
; Read and return the command's output
return exec.StdOut.ReadAll()
}