We are migrating perl script to powershell script. In Perl the code is as shown below
$rc=\'D:\\\\EmailConnector\\\\run.bat> $EmailConnector_log;\';
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.