RunAsCurrentUser with .bat and .cmd files

(imported topic written by SystemAdmin)

If anyone is looking to run .bat or .cmd files with RACU I found out that you need to pipe the output to get it to work. Apparently you need to do this for Windows to set some STD variables correctly.

Example:

wait __Download\RunAsCurrentUser.exe cmd.exe /C C:\Temp\Test.cmd > c:\Temp\Testout.txt

(imported comment written by SystemAdmin)

Also, you can pipe to NUL to avoid creating the output file.

wait __Download\RunAsCurrentUser.exe cmd.exe /C C:\Temp\Test.cmd > NUL