I need to call .bat file from Powershell script

后端 未结 3 779
广开言路
广开言路 2020-12-12 07:20

We are migrating perl script to powershell script. In Perl the code is as shown below

$rc=\'D:\\\\EmailConnector\\\\run.bat> $EmailConnector_log;\';
         


        
3条回答
  •  Happy的楠姐
    2020-12-12 07:53

    Use the call operator (&), like this:

    & 'D:\EmailConnector\run.bat' > $EmailConnector_log
    

    The return value of the batch script is automatically put into the variable $LastExitCode.

提交回复
热议问题