I need to call batch from powershell with specific working directory. I don't want new console to be opened, but I would like to see the output of the batch as a part of the output from powershell script.
I could forward the standard output to file and then write it by Write-Host, but the batch takes time and I would like to see the output in realtime as it is processing.
I tried Process-Start, but I don't know how to redirect standard output of batch to standard output of powershell.
&. Example:& "c:\yourbatch.bat"get-location, store that in a variable, change the working dir, call the script and finally set the previous location back. For example:$wd = Get-Location; Set-Location "you working dir"; & "Your batch"; Set-Location $wd