Re: Schedule Batch File-How to?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Fred,

I had the same question about a year ago.
Never found a (perfect) solution, however I did find an acceptable
workaround that works well for me.

From the top..... (For the benefit of others if needed)

Start>Settings>Control Panel>Scheduled Tasks.
Select "Add Scheduled Task" (This will open the "Scheduled Task Wizard")
Select the "Next" button.
In the Application List, Select the "Browse" button and browse to and select
the DOS or
Windows command that you are using within the batch file.
(Maybe located in C:\WINDOWS\system32\ or somewhere similar)

Using this approach, you will not be using the batch file anymore. But you
will be using the command line inside the batch file.

Select "Next" button.
Choose how often you want the task to run followed by the "Next" button.
(Can always change later if needed)
Choose the time of day for the task followed by the "Next" button.
The next window will ask for a password. Leave this blank and try not to
get excited about the warning.
This window will also display your computer name and your user login name.
Leave this field as is.
Select the "Next" button.
Apply a check to the "Open Advanced Properties" check-box and select
"Finish".
Answer "Okay" to the warning that pops up in the next window.

The properties window for the new scheduled task should now be open. If
not, double-click on the new task from the scheduled task listing.

In the advanced properties window for your new task, select the "Task" tab.
Apply a check to the "Run only if logged on" check-box.
Don't bother to add a password... you don't have one.

Here is where we get creative....

Note the command that is entered in the "Run:" field, should look like
this....
[Run:] C:\WINDOWS\system32\xcopy.exe
(I'm using the xcopy.exe command as an example)

Now open the batch file you created and have tested.

If your batch file contains only one command line your home free.
Copy-and-paste from the batch file the command and its parameters into the
task schedule "Run:" field.
You will want them to look the same.

Mine looks like this...
" C:\Windows\System32\xcopy.exe "E:\*.*" "F:\Backup of Documents Drive E" /E
/D /W /Y /I /R /K "

I'm using the xcopy.exe command to copy all (new or updated) files and
folders from partition drive (E) over to an external hard drive (F) every
day at 2:30PM as a scheduled task.
My drive (E) contains all my work related documents.
Cool Huh?

Now "apply" and close the task properties window and the task should run
according to the schedule (day/time) you selected.

If your batch file contained more than one (1) command line, You may need to
create a scheduled task for each command. (really not sure about this tho)

If what works well for me causes you problems. You might consider putting a
shortcut to the batch file on your desktop. You'll need to remember to
double-click the shortcut to run the batch file tho. Also, you could put
the shortcut in your startup folder. Then it will run each time you login,
pros-and-cons with this option as well I'm sure.

One last option is to create a script file to take the place of the batch
file. I think script routines co-exist much better with Windows (XP) and
task scheduler.
I don't know anything about scripts, maybe someone else can advise here.

Hope this is helpful!

Best regards,

Richard in Va.
+++++++++++++++++++++++++++++


"Fred" <Fred@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:10A69758-129A-43DC-A17D-6EBD575F7988@xxxxxxxxxxxxxxxx
I have a batch file I would like to schedule to run daily.

The attempt to use task scheduler and substitute the file.bat as the
program
did not work. I DO NOT have a password on my profile. There is an
administrator pw, but it is never needed. Now pw is ever needed.

I came across schtasks but did not know where to put it for execution,
unless it goes in the "program name" area of schedule task. However,
since
schedule task will have all the scheduling information, I was confused.

Assume I have a file batch.bat that I would like to have executed on
a
schedule, how do I do it?

I have already confirmed the batch file will run when executed in a dos
window.

Thank you.

Fred




.



Relevant Pages

  • Re: Schedule Batch File-How to?
    ... backup with your Robobkup program. ... Panel> Scheduled Task etc. and the batch file name was used as the ... Windows command that you are using within the batch file. ... The properties window for the new scheduled task should now be open. ...
    (microsoft.public.windowsxp.general)
  • Re: batch question
    ... window at great speed, without being executed. ... all I want is for the command to work inside a command prompt window. ... Your original batch file had two lines. ... you fell into a well-known trap: you are not executing ping.exe ...
    (microsoft.public.windowsxp.general)
  • Re: Batch File Problem - Batch File Enclosed
    ... I have added a batch file to my Startup folder to execute whenever ... The batch file works ok but it leaves a blank command ... I would like close this window using the batch file ...
    (microsoft.public.windowsxp.general)
  • Re: Execute a batch file and wait for it to complete
    ... and until I manually close the console. ... Starts a separate window to run a specified program or command. ... If it is an internal cmd command or a batch file then ...
    (comp.lang.fortran)
  • Build instructions for loadcepc.exe
    ... Build instructions for loadcepc.exe ... a standard cmd.exe window. ... Execute the batch file setupenv.bat: ... command promt ...
    (microsoft.public.windowsce.platbuilder)