8/12/09

DOS batch script to modify windows task scheduler

Recently I was annoyed by one rules which force me to get into the office on time. So I made a little script to automate my attendance. I then scheduled the script to run at a specified time. To make the scheduled time a little random I made a second simple script that change the scheduled tasks so the first script will run at random time from 7:10 to 7:49.

This is the script

====================
REM Script for change schedule

SCHTASKS /Delete /TN attend_in_khairil /F

REM attend_in_khairil
set /a menit_kiri_khairil=%random% %% 4 + 1
set /a menit_kanan_khairil=%random% %% 9
schtasks /create /RU DOMAIN\Username /RP Password /TN attend_in_khairil /TR "D:\absen\absen_in_khairil.bat" /ST 07:%menit_kiri_khairil%%menit_kanan_khairil%:00 /SC WEEKLY /D MON,TUE,WED,THU,FRI /SD 08/01/2009
====================

Simple huh ... I then just schedule this script to run everyday.

This way I will never be late at the office, hehehehe.





0 komentar: