Invoke simple synchronous pipeline
suggest changeGet the current date and time.
public class Program
{
static void Main()
{
// create empty pipeline
PowerShell ps = PowerShell.Create();
// add command
ps.AddCommand("Get-Date");
// run command(s)
Console.WriteLine("Date: {0}", ps.Invoke().First());
Console.ReadLine();
}
}
![](/essential/csharp/img/a92f51215d68310c509d13f2f36c587283a4cd4d.png)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents