If you receive an access violation or access denied error message in CMD.exe, and you are running SP4 or greater, there may be a workaround.

If your batch file:

1. Runs a long time

2. Uses the FOR /F command to process a files contents

3. Runs commands using the files contents as parameters

try implementing DisableHeapLookaside.