Run command weekly via logon script

edday

n00b
Joined
Jun 21, 2003
Messages
22
Hi.

I'm trying to get a program to be run once every thursday via a logon script, but haven't been able to find a way to do it. Does anyone know how i can do this?

Thanks
 
Are you really good wtih scripst? I'm not but this logic should work


You should be able to use a system vairable to print out the day. Do an if statment to check if its tuesday if not go to end or what ever.

I could probably write a batch file to do this but I'm not sure about scripts
 
If it's NT, 2K, or XP you can use the "at" command at the command prompt to schedule tasks.
 
I didnt use task scheduler, as the thought of going around and setting things manually(which may need to be changed later) didnt appeal to me :p, however i might have to do this on some laptops which are barely used.

I gave AT a go, but i couldnt get it to schedule a job for system bootup (could only specify hours:minutes)

I tried using the date variable, but until this morning i couldnt get it to do what i wanted. But, using this script i am able to get the day into a variable...


Code:
set myDay=%DATE:~-15,3%
echo %myDay%
 
edday said:
I didnt use task scheduler, as the thought of going around and setting things manually(which may need to be changed later) didnt appeal to me :p, however i might have to do this on some laptops which are barely used.

I gave AT a go, but i couldnt get it to schedule a job for system bootup (could only specify hours:minutes)

I tried using the date variable, but until this morning i couldnt get it to do what i wanted. But, using this script i am able to get the day into a variable...


Code:
set myDay=%DATE:~-15,3%
echo %myDay%

How about this, if you're looking for Friday (for example):

Code:
date > c:\temp\date.txt
find /i "Fri" c:\temp\date.txt
if errorlevel 1 goto end
<run your program here>
del c:\temp\date.txt
:end

Will that do the trick?
 
Ya didn't say what OS, but in 2000 and XP you have the ability to remotely add,delete, or modify scheduled tasks. At a command prompt do an "AT /?" to get a synopsis of the command.
 
superd00k said:
it seems to want to wait for input after the first line

Oops - I forgot a switch after the date command. How about:

Code:
date /t > c:\temp\date.txt
find /i "Fri" c:\temp\date.txt
if errorlevel 1 goto end
<run your program here>
del c:\temp\date.txt
:end
 
Ill have a look at the code there tomorrow when i have time..

I did try the 'at' command, however i cant seem to set the job to run at bootup, just hours:minutes. The OS's are 2k,XP, and 2k3.

The only problem i can see is that if the machine is rebooted during the course of the day, the program will be run again. Is there a way to ensure it only runs once? (maybe task scheduler does it?, never really looked at it before)

Thanks
 
If it's a login script set, it will execute every time the user logs in, unless you figure out a way to set a flag in a file or registry that indicates the task was already run for the day.

Maybe if you told us what kind of task you are trying to run, we may be able to figure out a different way to accomplish it.
 
Back
Top