Tool That Converts Any Batch File Into Powershell

Solution 1:

At this time there's no magic converter. However, there are tools you can utilize that will help you convert your batch scripts. One such tool is the Powershell ScriptoMatic.

http://technet.microsoft.com/en-us/library/ff730935.aspx

Solution 2:

To run or convert batch files externally from powershell (particularly if you wish to sign all your scheduled task scripts with a certificate) I simply create a powershell script e.g deletefolders.ps1

Input the following into the script:

cmd.exe /c "rd /s /q C:#TEMP\test1"

cmd.exe /c "rd /s /q C:#TEMP\test2"

cmd.exe /c "rd /s /q C:#TEMP\test3"

*Each command needs to be put on a new line calling cmd.exe again.

This script can now be signed and run from powershell outputing the commands to command prompt / cmd directly.

A much safer way then running batch files!