Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to show the command prompt window when launching a batch file from the task scheduler?

Tags:

batch-file

As my title states, I am wondering if it is possible to show the command prompt window (at least temporarily) to ensure that my batch file is indeed being executed as scheduled. The batch file runs without errors when I run it manually.

The batch file resides on Windows Server 2008 R2 Standard, x64 and I have service pack 1 installed. Let me know if more info required.

Thanks much!

like image 959
Anders Avatar asked Jul 26 '12 19:07

Anders


People also ask

Can you run a batch file in Task Scheduler?

You can configure the script using the Task Scheduler app to run it on schedule. Or you can save the batch files in the "Startup" folder to let the system run them as soon as you sign into the account. If you want to run a script on-demand, you can use File Explorer or Command Prompt.

How do you run a scheduled task without a command window appearing?

Right-click the Task Scheduler Library folder. Click the Create Task option. In the “General” tab, under the “Security options” section, select the Run whether user is logged on or not option. (This is the option that will make the command window not to appear when the task runs automatically.)


1 Answers

If you are trying to capture output, I like to dump to a log file. Put this as your program to execute in Task Scheduler:

myscript.bat >> error.log

If you REALLY want it to stay open, you could do -

cmd /k myscript.bat
like image 175
pyrospade Avatar answered Oct 12 '22 01:10

pyrospade