How to make the task scheduler display the cmd shell when invoking a batch file?
If you set a Scheduled Task to "Run only when user is logged on" and you are logged in as that user it will display the command window when the task is executed.
If you set it to "Run whether user is logged on or not" it will hide the command window. I'm guessing this is the option you selected. I don't think there's a way to have it display the command window with this option.
So you'll need to change the "Run" option.
After reading your post and requirement which I found matching mine requirements too. I did follow the following steps and could able to get my batch script running on desktop (in foreground);
- Under "Action"-> "Start a program"
- Under "Program/script" - "C:\windows\system32\cmd.exe /C start D:\(path of script dir)\batch_script.bat"
- Under "General" -> set "Run only when user is logged on"
- In my case, I use an admin user id and can keep my login session "locked", I do not know scenario of yours, whether you or other people login in windows 2008 r2 with different ids.So by doing this way I am getting desired output on my windows 2008 r2 server with windows scheduler.
A better solution to your problem might be to redirect errors and output to a logfile, and just tail that logfile.