cronJob on windows - windows

i wanna to create a cron job on windows that daily delete files from a specific folder.
how can i do this??
Thanks in advance

Use Schedule tasks in windows. Check here. You can use del command to remove one or more files. Put it inside a batch script and schedule it as a task.

You want Scheduled Tasks.
With Scheduled Tasks, you can schedule
any script, program, or document to
run at a time that is most convenient
for you. Scheduled Tasks starts every
time that you start Windows XP and
runs in the background, and it starts
each task that you schedule at the
time that you specify when you create
the task.
Edit your question if you specifically need help with the deleting files bit, but typing in help del at a command prompt should tell you everything you need to know.

I use Cron for Windows, it's very easy to use if you are familiar with cron from *nix

Related

Run console application automatically in windows

Is it possible to automatically run a console application on a particular time in a day.
With out set up any sheduler !
Not without any scheduler; something needs to invoke it.
Alternatively, you can write a separate app that runs on startup and starts your app for you at the desired time. This would mean that this background app would always be open.
Using the scheduler would be much easier.
If with "set up any scheduler" you refer to not installing something to do the schedule, there is no need to do that. Windows include it own scheduler.

Possible to only initiate scheduled task if shortcut/button clicked?

I've created 2 tasks in Task Scheduler on my Vista PC start uTorrent at 2am then close uTorrent (and shutdown PC) at 7am. However i'd like to only like this task to run if I've clicked a shortcut - ideally show something in the tray as well if possible. But not sure how?
Thanks in advance!
I managed to to something like this myself in windows 7, should be the same in Vista.
To do what you want you could create a scheduled task that starts utorrent, another to close it later and another to then shut down the pc, all timed to run every day at 2am. You would then create a task that runs a batch file to delete the other tasks every time you boot up.
You will have exported the first three tasks as XML files just after you created them and saved them somewhere.
The key is that you then create a batch file that, upon double clicking will create the scheduled tasks by importing the XML files. This will cause the tasks to run as before and shut down your pc afterwards. Next time you boot up your machine the tasks are deleted again by the first batch file.
Read up on batch files (simple command propt commands in a file that run when clicked) and the command-line interface for scheduled tasks.
Type schtasks /? at the command promt for more info.
Hope that makes sense.

Windows incremental backup script

I'm from a linux background, and need to run an incremental backup script on windows. I already have a batch script which dumps my database into a file. What I'd like is to only keep backups for the last seven days in addition to one backup file per week for the last 4 weeks (for example). I presume it's possible to do something like this with the windows task scheduler and a clever batch script?
Thanks.
Take a look at DeltaCopy - rsync for Windows. It's free, and does a great job.
ntbackup is a builtin Windows XP tool that can perform scheduled incremental backup.

Hourly cronjob on Windows

I just setup cron on my windows dev system in order to perform
an hourly run of a script.
I tried to edit crontab in order to run my script hourly, sadly
with no success.
Could anyone pls. drop me the crontab line which will execute
script.xy every hour?
If you're using Windows, why not use the built-in Scheduled Tasks (Accessories-System Tools)?
It may not show up immediately in the Wizard, but it is possible to set up tasks to be run hourly. Just add a daily task and then tick the "Open Advanced Properties" checkbox. Then go to the Schedule tab and again click "Advanced".
I figured it out: 0 * * * * C:\doSomeWork.script Makes the script run every full hour. Sometimes the easy way is the best... ;) thx anyway
I'd argue you probably don't want to be using Cron on Windows at all. Instead use a Scheduled Task (accessible through the Control Panel) and select your script.
Alternatively create a Windows service which runs your program hourly. I've never heard of people using Cron for Windows tasks in this way.
Can't you use the Windows Task Scheduler instead of crontab?
A commandline solution would look something like:
at 00:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
at 01:00 /EVERY:M,T,W,Th,F,S,Su yourScript.cmd
...
Notice that you have to schedule a new task for each hour.
Anyone got a better soluition for this using the at command?

How do you schedule a daily script run on Windows XP?

I wrote a script in Ruby. I'd like to run it every day at a certain time. How do you do that on a Windows XP system?
I poked around on the machine and discovered the "scheduled tasks" control panel, but it doesn't seem to have anything to do with running scripts, as far as I can tell from the options offered by the "wizard".
Scheduled Tasks. Sometimes, you have to make a batch file call the script, and schedule the batch.
say you have "script.vbs" you want to run, you will have to create this batch:
cscript script.vbs
cscript is the windows script host which interprets the vbs script. I'm sure ruby has something similar.
You can do it with scheduled tasks, just browse for the program or script you want to run if it isn't listed (in this case, the ruby interpreter I guess, and add the name of the script to run as an argument).
Use the Windows task scheduler.
Under Control Panel > Schedule Tasks.
You can set it up to run any application or file executable from the command line.
Update: (1/15/09)
A good point from Wouter van Nifterick, remember to take care that the process finishes before the next one runs (in comments).
This can be done by going into the advanced options and adjust the allowed amount of time the task may run.
If the task is already configured open it and click the Settings tab. At the top of this tab you will see a checkbox followed by 'Stop the task if it runs for:' then there are two text boxes to enter hours and minutes. If your script runs once a day you will want this set to 23 hours or so.
The 'at' command is a nice command line version of a scheduler.

Resources