Skip to content

Instantly share code, notes, and snippets.

@SamKr
Created October 31, 2018 10:58
Show Gist options
  • Save SamKr/dc7c21bd31b06fc6ce535ceed0dc0197 to your computer and use it in GitHub Desktop.
Save SamKr/dc7c21bd31b06fc6ce535ceed0dc0197 to your computer and use it in GitHub Desktop.
Launches a Powershell command with parameters
using (var pInstance = PowerShell.Create())
{
pInstance.AddCommand("Start-Process");
pInstance.AddParameter("-WindowStyle", "hidden");
pInstance.AddParameter("-FilePath", "\"explorer.exe\"");
pInstance.AddParameter("-ArgumentList", $"\"{drive}\"");
pInstance.Invoke();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment