Click here to Skip to main content
15,943,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i run my vb created application on windows scheduler?

What will i need to add?

I run my program in a single Form, with a combo box and 2 buttons.
Posted

You don't have to change anything — the scheduler service already exists. Instead, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

From the other hand, you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA
 
Share this answer
 
Comments
Alan Tuscano 16-Jan-12 22:14pm    
Hi SAKryukov,

I have found the Task Scheduler.

in my GUI, user selects entries will have press PROCESS button,
but in the Scheduled Task, with pre-selected entries, how will I run the process button, and where in the form's event will i put it?
Sergey Alexandrovich Kryukov 16-Jan-12 22:47pm    
Please, how a button is related to the service? Ever heard of separation of concerns? First of all, is this really VB, or VB.NET? What is "pre-selected entries"? You just put entries on scheduler. Do you want a button to schedule the event? Is your problem to run a command-line application or you want to use the API?
--SA
Alan Tuscano 16-Jan-12 22:59pm    
I'm using VB 2005

Manually, is the desktop and can be click, and run by a user.
The program has a ComboBox to select the TableName, to gather data, the Date Today, and Process Button to process,


But to give an option, the program will be loaded to the Scheduler,
My idea is i will create procedures(for the pre-selected entries),
and once the Scheduler runs the program, i will just call on the procedures.

But where i will put it the Call ProcedureNames() in the form?
You can use command arguments to start scheduled program.
In your form you check the command argument in the sub New()
public Class Yourform
Private _IsSchedule as boolean
public sub new()

If Environment.GetCommandLineArgs()(1) = "SCHEDULE" then
'start schedule procedure
else
'user
End If

end Sub


User can start your program without parameter .

In schedule task you start YourProgram.Exe SCHEDULE
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900