Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.CompilerServices
- Module ShellHelper
- <Extension()>
- Function Bash(ByVal cmd As String) As String
- Dim result As String = ""
- Using proc As System.Diagnostics.Process = New System.Diagnostics.Process()
- proc.StartInfo.FileName = "/bin/bash"
- proc.StartInfo.Arguments = "-c "" " & cmd & " """
- proc.StartInfo.UseShellExecute = False
- proc.StartInfo.RedirectStandardOutput = True
- proc.StartInfo.RedirectStandardError = True
- proc.Start()
- result += proc.StandardOutput.ReadToEnd()
- result += proc.StandardError.ReadToEnd()
- proc.WaitForExit()
- End Using
- Return result
- End Function
- End Module
Add Comment
Please, Sign In to add comment