Skip to content

Instantly share code, notes, and snippets.

@davidfowl
Created October 21, 2011 01:32
Show Gist options
  • Save davidfowl/1302887 to your computer and use it in GitHub Desktop.
Save davidfowl/1302887 to your computer and use it in GitHub Desktop.
IIS + sh.exe = fail
<%@ Page Language="C#" Debug="true" %>
<%
var exePath = @"C:\Program Files (x86)\Git\bin\sh.exe";
var working = @"C:\Program Files (x86)\Git\bin";
var args = "-c ls";
var psi = new System.Diagnostics.ProcessStartInfo {
FileName = exePath,
WorkingDirectory = working,
Arguments = args,
UseShellExecute = false,
RedirectStandardOutput = true
};
var process = System.Diagnostics.Process.Start(psi);
process.WaitForExit();
var output = process.StandardOutput.ReadToEnd();
Response.Write(output);
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment