Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."


23 May 2012   #1

Windows 7 64-bit
 
 
Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."

Hi,

I'm having a problem trying to automatically run a basic .bat file in task scheduler in windows 7 64-bit.

I have more complicated .bat files to schedule but I can't get a simple one to run.

This is the .bat file:

@ECHO OFF
ECHO hello there...
PING 1.1.1.1 -n 1 -w 5000 >NUL

It works fine manually - it opens a windows and displays the message and then closes after 5 seconds - no problems.

If I schedule it to automatically run in task scheduler nothing happens - no window appears - but it says its running.

I did create a .bat file in the same directory containing:

shutdown /r

This launched fine using task scheduler - the computer restarted - great.

Any ideas how to get a simple .bat file to execute in task scheduler other than restarting the computer?

I'm losing my hair - it shouldn't be this difficult.

Thanks.

My System SpecsSystem Spec
.

23 May 2012   #2

Win 7 Pro x64 SP1, Win 7 Ult x86 SP1
 
 

Which option do you have selected for your task?
"Run Only when user is logged on"
"Run whether user is logged on or not"
If it's not "Run Only when user is logged on", try using that option.
If that doesn't help:
Right click on the Task and click "End" to stop any running tasks.
Click "Enable all tasks history".
Right click on the Task and click "Run" to manually run the task.
See what messages show up in the History tab.
Are there any error messages?
My System SpecsSystem Spec
23 May 2012   #3

Windows 7 64-bit
 
 

I have selected:

Run whether user is logged on or not.

Run with highest privileges.

I have also disabled UAC completely.

I even created an .exe file using a macro program to run the .bat file - the .exe file runs fine when I double-click it - windows pops up and disappears as required - but the .exe file does not run either in task scheduler.

I have played around with the privileges of the file and everything is for Full Control.

The message shows up as "The operation completed successfully (0x0) - but I never saw the window appear.

Can anybody try creating a .bat file with the same action and try it on their system?

This should be basic stuff for a windows machine.

As I mentioned, I have more complicated .bat files that run great when I double-click them - but I NEED to run them in task scheduler.

Thanks.
My System SpecsSystem Spec
.


23 May 2012   #4

Windows 7 64-bit
 
 

History said it returned a code of 0.

I have another .bat file that sends characters to the serial port - but no characters ever appear to get sent to the serial port - but is the task actually completed if nothing is sent?

Strange.

Can anybody else recreate this.

It does this on two of my machines.
My System SpecsSystem Spec
23 May 2012   #5

Win 7 Pro x64 SP1, Win 7 Ult x86 SP1
 
 

Did you try running it with "Run Only when user is logged on" ?

I have seen where a task runs but no window is displayed.
That's what it sounds like is happening here.

When you run the Task do you see cmd.exe and conhost.exe start and end in Task Manager?
My System SpecsSystem Spec
23 May 2012   #6

Win 7 Pro x64 SP1, Win 7 Ult x86 SP1
 
 

Quote   Quote: Originally Posted by gigaoops View Post
History said it returned a code of 0.

I have another .bat file that sends characters to the serial port - but no characters ever appear to get sent to the serial port - but is the task actually completed if nothing is sent?
In Task Scheduler you can "Display all running Tasks".
If you have History enabled you should also be able to see if the task completed in the History Tab.
My System SpecsSystem Spec
23 May 2012   #7

Windows 7 64-bit
 
 

I tried a program called Freebyte Task Scheduler.

It's a free portable program that kinda like the windows program.

Guess what, the .bat files run fine - the hello .bat file executes when secheduled and the window appears and disappears.

I'll try it out with my more complicated .bat files.

Thanks for the info, but I'm just gonna give up on the windows task scheduler.

Too many headaches.

As a bonus, the Freebyte lets me easily move the program's schedules from computer to computer.

Thanks.
My System SpecsSystem Spec
23 May 2012   #8

Win 7 Pro x64 SP1, Win 7 Ult x86 SP1
 
 

Cool, glad you found a solution.
Thanks for that info - I'll have to check it out.
I know sometimes it's a real pain to get things working with Task Scheduler.
My System SpecsSystem Spec
23 May 2012   #9

Windows 7 64-bit
 
 

Why does Microsoft make Task Scheduler so complicated - it's supposed to be a program to help simplify and automate things for the user?

Right now it's completely useless to me - I can't remember wasting more time on something that SHOULD have been so simple.

There doesn't appear to be any logic in how it's implemented in windows 7.

Thanks to the guys who created the third-party software.
My System SpecsSystem Spec
Reply

 Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."




Thread Tools



Similar help and support threads for2: Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."
Thread Forum
Solved "Open File - Security Warning" when running a LNK file General Discussion
W7 64bits Task Scheduler, the selected task "{0}" no longer exists General Discussion
Default "Browse for file" location in web browser "choose file" box Customization
Solved I cannot find Restore Points created "daily" with Task Scheduler. Backup and Restore
Task Scheduler not running General Discussion
task scheduler not running missed task General Discussion
the task bar "folder" pinned "program" General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:41 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33