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
gigaoops

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
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

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
gigaoops

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
gigaoops

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
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

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
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

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
gigaoops

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
DavidE

Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64
 
 

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
gigaoops

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 Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Task Scheduler - need help understaing "Conditions"
Hi *, So as the subject states I need help understanding how windows enumerate networks for "Conditions" listed under "Start only if following network connection is available". Firstly, let me say I understand that WiFi network names are listed there, but I see much more there which I can't map...
General Discussion
"Task scheduler" & where to find it?
Hi guys, I have been told that Windows 7 includes something called a Task scheduler and that I can get it to do things like running security scans automatically before the PC shuts down. Now, this may sound a bit strange but I can't find it. Mostly because I'm blind as a bat and the Computer...
General Discussion
"Open File - Security Warning" when running a LNK file
Ever since I started using Windows Live Mail, I get the following every time I start it: How do I stop this?
General Discussion
W7 64bits Task Scheduler, the selected task "{0}" no longer exists
Hi, So I don't know when this: "the selected task "{0}" no longer exists. to see the current task, click refresh" error started but I don't know how to repair this. When I start task scheduler I first get this error and than no matter what folder I click the error pops up again. After this 2nd...
General Discussion
I cannot find Restore Points created "daily" with Task Scheduler.
Task Scheduler is setup to create restore points every day at midnight and at startup. It indicates that it runs successfully but those points do not show up in System Restore.
Backup and Restore
task scheduler not running missed task
When i set task scheduler to run a program it works. But if the pc is not on at the time it will not run unless task scheduler is opened. It is set to run as soon as poss after scheduled time and task scheduler itself starts and runs properly
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 07:17.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App