There are some missing closing quotes on the top script you posted. Try this out...

Code:
$DOMAIN = "TPE"


IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\buffers")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\buffers" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF
IF EXIST ("C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved")
SHELL '%comspec% /c XCACLS "C:\Program Files\The Produce Exchange\TPEAllocator\XML\Saved" /C /T /G "'+$DOMAIN+'\Everyone":F'
ENDIF



Not sure if you really need the quotes around the DOMAIN\Everyone part or not though. That may be screwing you up as well.