Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Running a Batch Job through Windows 7 Task Scheduler

Posted on 2012-08-27
3
Medium Priority
?
1,357 Views
Last Modified: 2012-08-27
Hi I have the following batch file that I am trying to get running through the Task Scheduler.  When scheduled, it runs the first part of the job copying the files to the backup folder but it does not then move the files to the network location.  The Task Scheduler nonetheless returns a message that the job completed successfully.

I have checked the permissions on both the source and destination locations and both have full access.

When I double click on the .bat file from my desktop the job completes all stages successfully as expected - it is only when run through the task scheduler that the job does not complete.

Here is the batch file detail:
@echo off
rem Copy Test files Between Folders
copy "C:\Users\jreddy\Documents\Training Programs\T*.*" "C:\Users\jreddy\Documents\Training Programs\backup"
move "C:\Users\jreddy\Documents\Training Programs\T*.*" "\\ausmel-fp01\users\jreddy\Test"
0
Comment
Question by:sochionnaitj
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 38339388
are you running as the currently logged on user? or as jreddy ??
@echo off
rem Copy Test files Between Folders
copy "C:\Users\jreddy\Documents\Training Programs\T*.*" "C:\Users\jreddy\Documents\Training Programs\backup"
move "C:\Users\jreddy\Documents\Training Programs\T*.*" "\\ausmel-fp01\users\jreddy\Test" 

Open in new window


suggest:
@echo off
rem Copy Test files Between Folders
copy /y "C:\Users\jreddy\Documents\Training Programs\T*.*" "C:\Users\jreddy\Documents\Training Programs\backup"
move /y "C:\Users\jreddy\Documents\Training Programs\T*.*" "\\ausmel-fp01\users\jreddy\Test" 

Open in new window

add the /y switch to not prompt for over write  /-y to not over write
0
 

Author Comment

by:sochionnaitj
ID: 38339446
Hi,  I am running as the current logged on user, which is jreddy.

I have added the /y as recommended.  The .bat still runs successfully when run directly from my desktop but does still does not work when run via the Task Scheduler.

It completes the first line of instruction: copy /Y "C:\Users\jreddy\Documents\Training Programs\T*.*" "C:\Users\jreddy\Documents\Training

but not the second

move /Y "C:\Users\jreddy\Documents\Training Programs\T*.*" "\\ausmel-fp01\users\jreddy\Test
0
 

Author Closing Comment

by:sochionnaitj
ID: 38339500
Thanks, I needed to change the User/Group under the Security Options.  This allows me to run when I am logged on, which is fine for me.  Running it when I'm logged off will probably be another question when I get around to that one.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question