Created
October 31, 2018 10:58
-
-
Save SamKr/dc7c21bd31b06fc6ce535ceed0dc0197 to your computer and use it in GitHub Desktop.
Launches a Powershell command with parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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