Scheduled task in setup project?

virtualeffect

New member
Joined
Feb 8, 2009
Messages
3
Programming Experience
3-5
I'm trying to figure out how to add the creation of a scheduled task to the setup project of a solution so that it will install the main executable and also schedule it to run in windows\scheduled tasks. The project is in vb.net 2005 Any Suggestions?
 
To elaborate on what VB.MAN implied, you can add a Custom Action to your Setup project and then use Process.Start to execute a commandline. You can open a command prompt window and type "schtasks /?" (without quotes) to see what options are available. You can then experiment until you get the commandline that will correctly create the scheduled task you want. Once you've got the correct commandline arguments you can pass them to schtasks in code like so:
VB.NET:
Process.Start("schtasks", "commandline arguments here")
 
That's true, sorry my post was very short...

<Advertising link removed by moderator>
 
Last edited by a moderator:
Excellent!

Hi guys, thanks alot.. the process.start with schtasks as a customaction worked great. I added on for the install and the uninstall sections..

thanks very much.
 
ok,, it's leaving out the quotes on the run line in the scheduled task..

because of that it won't run.. so I'm trying to figure out how to add quotes around the task to run when it makes the task..
 
because of that it won't run.. so I'm trying to figure out how to add quotes around the task to run when it makes the task..
If you mean you want to include a double quote in a literal string then you need to escape it with a second double quote, e.g.
VB.NET:
Dim str As String = "He said ""Hello"" to me."

MessageBox.Show(str)
 
Back
Top