Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string exec(String cmd, String args)
- {
- string retMessage = String.Empty;
- /*
- * C:\Program Files\Oracle\VirtualBox\VBoxManage.exe guestcontrol "Devel" execute --image "/bin/ls" --username="fotka" --password="@fotka" --wait-exit --wait-stdout /tmp
- */
- string vbm = @"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe";
- string vbargs = " guestcontrol \"Devel\" execute --image \"" + cmd + "\" --username=\"fotka\" --password=\"@fotka\" --wait-exit --wait-stdout ";
- ProcessStartInfo startInfo = new ProcessStartInfo();
- Process p = new Process();
- startInfo.CreateNoWindow = true;
- startInfo.RedirectStandardOutput = true;
- startInfo.UseShellExecute = false;
- startInfo.Arguments = vbargs;
- startInfo.FileName = vbm;
- p.StartInfo = startInfo;
- p.Start();
- p.WaitForExit();
- return p.StandardOutput.ReadToEnd();
- }
Add Comment
Please, Sign In to add comment