Skip to content

Instantly share code, notes, and snippets.

@simply-coded
Last active September 5, 2020 14:17
Show Gist options
  • Save simply-coded/a06d1adc4c6c96e1282bcb9be6e55ed7 to your computer and use it in GitHub Desktop.
Save simply-coded/a06d1adc4c6c96e1282bcb9be6e55ed7 to your computer and use it in GitHub Desktop.

Revisions

  1. simply-coded renamed this gist Sep 5, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. simply-coded revised this gist Dec 29, 2018. 3 changed files with 2 additions and 34 deletions.
    2 changes: 2 additions & 0 deletions Console.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    This has been updated and moved here:
    https://gist.github.com/codeartery/9c0317129b64ce63733ba692a7211dc1
    15 changes: 0 additions & 15 deletions Console.vbs
    Original file line number Diff line number Diff line change
    @@ -1,15 +0,0 @@
    Function Console(strCmd)
    '@description: Run command prompt command and get its output.
    '@author: Jeremy England ( SimplyCoded )
    Dim Wss, Cmd, Return, Output
    Set Wss = CreateObject("WScript.Shell")
    Set Cmd = Wss.Exec("cmd.exe")
    Cmd.StdIn.WriteLine strCmd & " 2>&1"
    Cmd.StdIn.Close
    While InStr(Cmd.StdOut.ReadLine, ">" & strCmd) = 0 : Wend
    Do : Output = Cmd.StdOut.ReadLine
    If Cmd.StdOut.AtEndOfStream Then Exit Do _
    Else Return = Return & Output & vbLf
    Loop
    Console = Return
    End Function
    19 changes: 0 additions & 19 deletions usage.vbs
    Original file line number Diff line number Diff line change
    @@ -1,19 +0,0 @@
    stdout = Console("echo Hello there")
    MsgBox stdout

    '============================================================
    Function Console(strCmd)
    '@description: Run command prompt command and get its output.
    '@author: Jeremy England ( SimplyCoded )
    Dim Wss, Cmd, Return, Output
    Set Wss = CreateObject("WScript.Shell")
    Set Cmd = Wss.Exec("cmd.exe")
    Cmd.StdIn.WriteLine strCmd & " 2>&1"
    Cmd.StdIn.Close
    While InStr(Cmd.StdOut.ReadLine, ">" & strCmd) = 0 : Wend
    Do : Output = Cmd.StdOut.ReadLine
    If Cmd.StdOut.AtEndOfStream Then Exit Do _
    Else Return = Return & Output & vbLf
    Loop
    Console = Return
    End Function
  3. simply-coded revised this gist Aug 6, 2017. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  4. simply-coded created this gist Jul 16, 2017.
    15 changes: 15 additions & 0 deletions console.vbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    Function Console(strCmd)
    '@description: Run command prompt command and get its output.
    '@author: Jeremy England ( SimplyCoded )
    Dim Wss, Cmd, Return, Output
    Set Wss = CreateObject("WScript.Shell")
    Set Cmd = Wss.Exec("cmd.exe")
    Cmd.StdIn.WriteLine strCmd & " 2>&1"
    Cmd.StdIn.Close
    While InStr(Cmd.StdOut.ReadLine, ">" & strCmd) = 0 : Wend
    Do : Output = Cmd.StdOut.ReadLine
    If Cmd.StdOut.AtEndOfStream Then Exit Do _
    Else Return = Return & Output & vbLf
    Loop
    Console = Return
    End Function
    19 changes: 19 additions & 0 deletions usage_1.vbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    stdout = Console("echo Hello there")
    MsgBox stdout

    '============================================================
    Function Console(strCmd)
    '@description: Run command prompt command and get its output.
    '@author: Jeremy England ( SimplyCoded )
    Dim Wss, Cmd, Return, Output
    Set Wss = CreateObject("WScript.Shell")
    Set Cmd = Wss.Exec("cmd.exe")
    Cmd.StdIn.WriteLine strCmd & " 2>&1"
    Cmd.StdIn.Close
    While InStr(Cmd.StdOut.ReadLine, ">" & strCmd) = 0 : Wend
    Do : Output = Cmd.StdOut.ReadLine
    If Cmd.StdOut.AtEndOfStream Then Exit Do _
    Else Return = Return & Output & vbLf
    Loop
    Console = Return
    End Function