Quote:
Running it without %comspec% /c works fine but I need this to be able to redirect the output of dtexec.exe to a text file


This makes me think we can get it to work.

Can you run one of your scripts that outputs the value of $shell so we can see what it looks like?