How can you do this? I want to have my program run every once in a while but I don't want to make it a service.
Printable View
How can you do this? I want to have my program run every once in a while but I don't want to make it a service.
At /?
Quote:
setting sdk environment relative to c:\program files\microsoft sdks\windows\v6.0
.
Targeting windows vista x64 debug
c:\program files\microsoft sdks\windows\v6.0>at /?
the at command schedules commands and programs to run on a computer at
a specified time and date. The schedule service must be running to use
the at command.
At [\\computername] [ [id] [/delete] | /delete [/yes]]
at [\\computername] time [/interactive]
[ /every:date[,...] | /next:date[,...]] "command"
\\computername specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
Id is an identification number assigned to a scheduled
command.
/delete cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes used with cancel all jobs command when no further
confirmation is desired.
Time specifies the time when command is to run.
/interactive allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] runs the specified command on the next occurrence of the
day (for example, next thursday). If date is omitted, the
current day of the month is assumed.
"command" is the windows nt command, or batch program to be run.
C:\program files\microsoft sdks\windows\v6.0>
Are you looking for the code to create a scheduled task or are you looking for how to create a scheduled task in general. For first question, you should take a look at SCHTASK.EXE, this is a dos command and has a command line switch /Create that will let you create/schedule the tasks. You could also use AT. Just open the command prompt and write SCHTASK /? to see all the options. reading documentation would also help. You can then use the command using Shell in VB.
For Question2, open control panel, you will see the scheduled tasks icon, double click on it and it will let you manually create scheduled tasks.
So I have to run a shell command. I can do that. Thanks.
You can call your .exe directly from the Task Scheduler, or else you could write a 3 line .CMD file (New Batch File)
I try these. Thanks for the suggestions.