Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a console application written in VB.Net. All I want is it to run automatically when the computer starts.

share|improve this question

migrated from Sep 23 '11 at 4:10

This question came from our site for professional and enthusiast programmers.

up vote 8 down vote accepted

Create an entry in registry under

  1. Start regedit.exe
  2. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
  3. Create a new string value and give it tha title you please (it's just for you, to rememeber what is it)
  4. Set the value to the full path (and params) of the EXE you want to run.
share|improve this answer
That will make it start with user login. Not at computer startup unless you've configured auto-login. – Ben Voigt Dec 13 '12 at 15:37

You can just simply add it to the Startup folder in the Start Menu in Windows and it will startup with the computer.

share|improve this answer
No, it will start with user login. Not at computer startup unless you've configured auto-login. – Ben Voigt Dec 13 '12 at 15:37
@BenVoigt Thanks for pointing that out, I forgot about that. Easy to overlook something like that. Although it looked like Marco's answer was accepted so OP looks like he had auto login setup or only cared to run it when he logged in. – Jesus Ramos Dec 13 '12 at 20:19

I would set it up in the task scheduler, run the scheduler from control panel / administrative tools, create a new task and set the trigger to "When the computer starts".

Or you can do it in your setup program, or write some code using Microsoft.Win32.TaskScheduler.dll that is run within the setup program.

share|improve this answer

The simplest way to achieve this would be to convert your console application into a Windows Service.

However, you could look at the Scheduled Tasks and see if there is an option to start the application when the computer starts.

share|improve this answer

I think the question here is that as a programmer how to make a program automatically run on it own when a computer starts up just like anti virus programs which automatically starts once the user has logged on his computer.

I'm also looking for the same answer like code to the program the Auto-run which the computer will read then execute the program.

If you are a user, here is the line of code I've manage to write to automatically write and save auto-run on a computer.

First, you will need to locate the correct place or directory in which a computer will look for the auto-run, and if you are targeting the users who use Windows XP, the directory is just Drive "C". You also have to check if there is an auto-run already there because the computer won't store two of the same files. So if there is an auto-run, then you will just have to edit it and keep in mind that the auto-run that is already there is stored for another program. You don't have to remove it or override it because the program that is using it will not automatically run.

On your code on form_load you first have to check if the Auto-run is existing or not, so here is how you do it. Remember, these codes will go under the Form_load

Private Sub Form1_Load()
If"C:\autorun.inf") Then
Dim auto-run As String()
auto-run = vbCrl & "[autorun]" & vbCrl & "icon=your icon.ico" & vb Crl & "open=your application name.exe" & vbCrl & "action=Run" & vbCrl & "shell\open\command=your location when your application will or is installed at.exe[autorun]"

NB: all the above code you write it in one line to prevent the Errors. Now you need to write it ow here. I assumed that on Drive C there is an auto-run so let go on editing it."C:\autorun.inf",auto-run,True)

If"C:\done.txt") Then
' Do nothing
Else"C:\autorun.inf",auto-run,True)"C:\done.txt","Autorun created",True)
End If
End If
End Sub

That is the code but remember that in other computers your program will need permissions to read and write to a Drive so you have to grant your program the permissions that is also done in codes.

We also check if autorun has been created. If it has been created then we stop the program from always creating the autorun because that will confuse our autorun. So this will simply write once only.

Note that this is not supported on Windows 7 so I'm still trying to invent a new way or get a new way. I think the answer of Jesus r is the best answer if you are using or targeting Windows 7 or 8.

The best way to automatically do the answer of Jesus R is to first know the Default directory of the Startup folder. Then, when you are creating your installation wizard, you will simply instruct it to save your program on the Startup folder.

share|improve this answer
The code and area you are looking in are NOT for starting applications as the computer boots/windows loads. That file (autorun.inf) is for launching a program as a drive is browsed by the user. More commonly used by CD/DVD-ROM's (to run setups/installations). Your english (although good) has very poor grammar & punctuation making it very long and hard to read. Someone with more time may take the effort to correct it, but as this is not the correct answer it is probably better removed. – HaydnWVN Dec 13 '12 at 14:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.