Guest User

Untitled

a guest
Jan 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Imports System.Runtime.CompilerServices
  2.  
  3. Module ShellHelper
  4. <Extension()>
  5. Function Bash(ByVal cmd As String) As String
  6. Dim result As String = ""
  7.  
  8. Using proc As System.Diagnostics.Process = New System.Diagnostics.Process()
  9. proc.StartInfo.FileName = "/bin/bash"
  10. proc.StartInfo.Arguments = "-c "" " & cmd & " """
  11. proc.StartInfo.UseShellExecute = False
  12. proc.StartInfo.RedirectStandardOutput = True
  13. proc.StartInfo.RedirectStandardError = True
  14. proc.Start()
  15. result += proc.StandardOutput.ReadToEnd()
  16. result += proc.StandardError.ReadToEnd()
  17. proc.WaitForExit()
  18. End Using
  19.  
  20. Return result
  21. End Function
  22. End Module
Add Comment
Please, Sign In to add comment