Create a file with a .ps1
extension. Put this in the file:
param($path = $pwd)
mongo $path\a.js > $path\aout.txt
mongo $path\b.js > $path\bout.txt
The above assumes mongo is in your path. Now make sure you have execution policy set to allow scripts to run. Execute this in PowerShell (running as admin):
Set-ExecutionPolicy RemoteSigned # you can also use Unrestricted if you'd like
Then execute your script e.g.:
C:\> C:\mymongo\mongo-it.ps1 C:\mymongo