Skip to content

Shell/Bash tasks in Windows using the task runner #48

Answered by alirezanet
Eric-Bonneau asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Eric-Bonneau

Unfortunately Process.Start in Dotnet doesn't support this format (%PROGRAMFILES%) that's why you can not pass this value, but for now, you have a few workarounds to access sh.exe:

  1. Adding C:\Program Files\Git\bin to your system environment PATH, this way sh.exe would be available through cmd. (also there is an option for this during git installation)
  2. HardCode C:\Program Files\Git\bin\sh.exe instead of %PROGRAMFILES%\...
  3. Use a CSX file to run your script. e.g
private var shPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) , @"git\bin\sh.exe" );
private var startInfo = new ProcessStartInfo(shPath, "display-version.sh");
Process.Start(s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alirezanet
Comment options

@Eric-Bonneau
Comment options

Answer selected by alirezanet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants