Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Windows 2008 R2 and I am trying to schedule my application in the Task Scheduler. I have created a batch with the right settings.

The problem I have is: I need to display the Cmd shell window (with the bat running), but the task scheduler launches the application in the background and the Cmd window is no where to seen.

I tried different things from the task scheduler:

- cmd /c start ...MyProgram.bat does not work.
- I tried calling my batch directly does not work.
- I also tried a piece of vbs script with winScriptHost.run does not work either.

What did I miss? How can I resolve this?

share|improve this question
up vote 1 down vote accepted

I don't think the task scheduler GUI gives any way to run an interactive task. But the AT command does appear to. I found this article on technet that describes (among other things) the /interactive switch for the AT command.

share|improve this answer
    
Thanks for your responses. I will try the AT command. – Alain Nov 3 '11 at 18:41

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.

share|improve this answer
    
Thanks. I was looking for this option. I basically want to have it happen that if I login to my server and the task is running, I will see it, so I instantly know if it causes my server to be slower than normally and I'm not looking at other things. – LPChip Mar 19 at 14:16

A better solution to your problem might be to redirect errors and output to a logfile, and just tail that logfile.

share|improve this answer
    
I thought about that but my problem is that I can query the app while it is running, so that is why I need the cmd window. – Alain Nov 3 '11 at 17:39
    
I'm not sure I understand how that makes it a problem. – mfinni Nov 3 '11 at 17:43

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.
share|improve this answer
    
It would be a good idea to make use of the formatting features, to make this answer easier to read. – kasperd May 12 at 6:59
    
Thanks for your comment. I have corrected as per your suggestion. – Ashish Sarraf May 12 at 13:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.