windows - How to have powershell script execute batch command in same terminal -
i have powershell 2 script i'm trying develop. purpose of script wrap around batch script , intelligently take version of said batch script run. somewhere along lines in code have logic goes this:
& $mycommand $args
$mycommand qualified filename of batch file want run. $args args passed script. works except opens command window when running $mycommand. how prevent output within same powershell shell?
what's odd if execute command directly, shows way want it. like:
c:\mycommand.bat $args
given need take command want run @ runtime, how create output in same shell when utilize '&' execute command in variable? thanks!
use start-process
-nonewwindow
parameter instead of &
:
start-process -filepath c:\mycommand.bat -argumentlist @("arg1","arg2") -nonewwindow
windows powershell batch-file
No comments:
Post a Comment