While we would usually see a .bat file being called in a Job using the Command execution method, users can do the same in a PowerShell Job. To start a command procedure from PowerShell, use the following code in your PowerShell source and modify for your file path and name:
C:\Path\file.bat
If users want to capture the output of the .bat, you can use this:
$out = C:\Path\file.bat
If users want to control the starting of a process, you can use the PowerShell Start-Process cmdlet:
Start-Process C:\Path\file.bat
If users want to control cmd.exe, you can use this:
Start-Process "cmd.exe" "/c C:\Path\file.bat"
Comments