We are migrating perl script to powershell script. In Perl the code is as shown below
$rc=\'D:\\\\EmailConnector\\\\run.bat> $EmailConnector_log;\';
Or, since there are no spaces in the path, you can just execute the batch file directly from PowerShell:
D:\EmailConnector\run.bat > $EmailConnector_log
This is one of the advantages of PowerShell being both a "shell" and a "scripting language". Execution of batch, cmd, vbs, exe files is straightforward - usually. Parameter passing can be an issue but these days that is easily solved with the stop parsing operator: --%.