Task Scheduler will not run task

Blue_Ridge

Distinguished
May 22, 2011
4
0
18,510
I have created a batch file that performs as expected when I double click on it, or run it from the Windows <Run> window. However, Task Scheduler will not run it. I am running Win7 Professional 64 bit. Screen shots of my setup for this task can be found at:

http://www.flickr.com/photos/rb_henard/sets/72157626656200523/

If the issue is in the Location line of the General tab being blank then (NOTE NOT the file location}:

1. Please tell me how to edit that line because I have NEVER been able to enter a value on that line

2. What should the location be.

Thanks
 
Solution
OK, then the problem is that you're going to need to come up with a command line that will run the program. You can't just paste a shortcut or document name into the Task Scheduler, it has to be the name of the program that opens or processes the document.

Assuming that "C:\Users\Public\Documents\PBA Folder Sync (batch).ffs" is the full filename of the file you're trying to run, open a Command Prompt window (Start, type "cmd" into the search box and press ENTER) and try typing the following into the window followed by the ENTER key:

start "" "C:\Users\Public\Documents\PBA Folder Sync (batch).ffs"

Note that the extra pair of "s after "start" are required.

Does that start the program? If so, then what you want to do is to change...
The "Location" item on the "General" tab shows you what folder the task is in in the left pane of Task Scheduler. It has nothing to do with the default folder that's in effect when the task runs.

The location is purely for the purposes of organizing your scheduled tasks. For example you could create a Task Scheduler folder by right-clicking on "Task Scheduler Library" in the left pane and select "New Folder", then naming the folder "Daily Jobs". You can't edit the "Location" field directly, but if you move your scheduled task into the new task scheduler folder then the "Location" field will change to reflect where it is now.

Can you post the details of the "action" for the task? Click the "Action" tab for the task, then highlight the action and click "Edit..." and post the resulting "Edit Action" dialogue box. That will show what command you're trying to run, what the command parameters are, and what the default folder is when the command is executed.

If we compare that to what you type in a Command Prompt window to run the program manually and what the default folder is when you do that, we can probably figure out where the problem lies.
 

Blue_Ridge

Distinguished
May 22, 2011
4
0
18,510
Can you post the details of the "action" for the task? Click the "Action" tab for the task, then highlight the action and click "Edit..." and post the resulting "Edit Action" dialogue box. That will show what command you're trying to run, what the command parameters are, and what the default folder is when the command is executed.

Here is the screenshot of that window.

http://www.flickr.com/photos/rb_henard/5748631176/in/photostream

Note I've never tried running this batch file from a command prompt. Only by double clicking on it in from windows explorer or browsing to it from the Start-Run window.
 
OK, then the problem is that you're going to need to come up with a command line that will run the program. You can't just paste a shortcut or document name into the Task Scheduler, it has to be the name of the program that opens or processes the document.

Assuming that "C:\Users\Public\Documents\PBA Folder Sync (batch).ffs" is the full filename of the file you're trying to run, open a Command Prompt window (Start, type "cmd" into the search box and press ENTER) and try typing the following into the window followed by the ENTER key:

start "" "C:\Users\Public\Documents\PBA Folder Sync (batch).ffs"

Note that the extra pair of "s after "start" are required.

Does that start the program? If so, then what you want to do is to change the Action of your scheduled program to put the following into the "Program/Script" box:

cmd

...and the following into the "Add arguments (optional)" box:

/c start "" "C:\Users\Public\Documents\PBA Folder Sync (batch).ffs"
 
Solution

hammerhead2010

Honorable
Jan 30, 2013
1
0
10,510
I had to reply because I could not find anything on the net that helped me. So I thought I would help others....

After an hour or better of struggling with this similar thing, I figured out that you have to mount a network share "IN YOUR BATCH FILE" to get the output to be copied to that network share.

My suggestion, first try to adjust your batch file to write the output to a LOCAL drive. If that works, then use the "net use" commands to mount and dismount the drives.

net use I: \\ip of machine\folder
command to run
net use I: /delete


arrrgggghhh..... I hate task scheduler and windows for that matter. but if you have to use it.......make it work for you. MS ripped off linux and unix for everything else....you think they could have taken cron to....






 

halmeida

Honorable
Apr 23, 2013
2
0
10,510
Hi,
I have a similar problem but my situation e little bit different, My script is supposed to rename a XML file with the local hour and then copy it to a different location. Well the copy its made but rename cicle not. Can you guys help me?

Here is the code:
XML:
 For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
 @ECHO %mytime%
 FOR %%d in (*.xml) DO (
 rename %%d %%~nd%mytime%".xml"
 )

copy c:\folder\*.xml  \\server\folder1\ 
copy c:\folder\*.xml  \\server\folder2\

move c:\folder\*.xml c:\folder\transffered
This Scrpt runs in Windows XP But its not working in Windows 7 32 BIT

Thanks
 

Mildren7650

Reputable
Jun 18, 2014
1
0
4,510
Thanks so much for the tip to use NET USE to map to a share within, in our case, a batch file. I have been searching for months since moving from a Windows 2003 server to Windows 2012 server where our batch routines that worked on 2003 were not on 2012. Now my batch files are running to the end, although the Task Scheduler says the task that calls them are still running. Any ideas about that?

Thanks again!

Jack