public InvokeCommands ( System.Management.Automation.PSCommand profileCommands ) : void | ||
profileCommands | System.Management.Automation.PSCommand | |
리턴 | void |
public void InvokeCommands(PSCommand[] profileCommands)
{
lock (_dispatcherLock)
{
using (var powerShell = System.Management.Automation.PowerShell.Create())
{
powerShell.Runspace = _runspace;
foreach (PSCommand command in profileCommands)
{
powerShell.Commands = command;
powerShell.AddCommand("out-default");
powerShell.Invoke();
}
}
}
}
private static void LoadProfilesIntoRunspace(RunspaceDispatcher runspace) { PSCommand[] profileCommands = HostUtilities.GetProfileCommands(ProfilePrefix); runspace.InvokeCommands(profileCommands); }