Skip to content
Yevhen Bobrov edited this page Apr 3, 2020 · 1 revision

Running shell commands

using static Nake.Shell;

// batch scripting is fully supported
Cmd(@"
    @ECHO OFF 
    CD C:\source
    FOR %%f IN (*.doc *.txt) DO XCOPY C:\Source\""%%f"" C:\Text /m /y
");

// optional parameters gives you more granular control
Cmd("{script}"
    string[] environmentVariables = null, 
    string workingDirectory = null,  // current directory if null (default)
    bool echoOff = true, 
    bool ignoreStdOutErrors = false,
    bool ignoreExitCode = false,
    bool disableStdOutLogging = false
);

Awaiting shell commands

var result = await $"docker bulld -f {spec} .";
WriteLine(result.ExitCode);
result.StdOut.ForEach(WriteLine);
Clone this wiki locally