How to pass arguments to a dotnet script
Learn how to pass arguments to a dotnet script using the -- separator and access them via the Args collection.
When using dotnet script you can pass arguments by specifying them after — (two dashes). You can then access the arguments in the script using the Args collection.
Let’s take an example. Assume we have the following myScript.csx script file:
Console.WriteLine($"Inputs: {string.Join(", ", Args)}");
We can pass parameters to this script as follows:
dotnet script myScript.csx -- "a" "b"