Created
October 22, 2015 16:32
-
-
Save grmartin/9524d2302f9e78587e65 to your computer and use it in GitHub Desktop.
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
function Invoke-Batch { | |
param ( | |
[Parameter(Mandatory=$True)] | |
[String] $BatName | |
) | |
$psi = New-object System.Diagnostics.ProcessStartInfo | |
$psi.CreateNoWindow = $true | |
$psi.UseShellExecute = $false | |
$psi.RedirectStandardOutput = $true | |
$psi.RedirectStandardError = $true | |
$psi.FileName = "cmd.exe" | |
$psi.Arguments = @("/c $BatName") | |
$process = New-Object System.Diagnostics.Process | |
$process.StartInfo = $psi | |
[void]$process.Start() | |
$x = $process.StandardOutput.ReadToEnd() | |
$process.WaitForExit(); | |
return $x | |
} | |
Set-Alias Call Invoke-Batch | |
Set-Alias ibat Invoke-Batch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment