I have the following code:
PowerShell ps = PowerShell.Create();
// Call the PowerShell.AddCommand(string) method, add
// the Get-Process cmdlet to the pipeline. Do
// not include spaces before or after the cmdlet name
// because that will cause the command to fail.
ps.AddCommand("mkdir");
ps.AddArgument("C:\\Users\\me\\Desktop\\test");
Unfortunately, when I run this piece of code, no directories are created. I guess I am misunderstanding how this works, but ideally, I want my final application to be able to run powershell commands and then grab the output directly within my application.
What am I doing wrong to execute a simple powershell command from my code?
ps.Invoke()