Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How is it possible to have an executable run automatically on startup? Is it possible by having a shortcut to the .exe in the startup folder in the All programs section of the start menu? If that is correct, what is the full directory of the startup folder?

share|improve this question

migrated from stackoverflow.com Mar 31 '10 at 3:14

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

1  
What version of Windows? –  Uri Mar 31 '10 at 2:01
    
I suppose Windows 7. If not it would be equally interesting to know about windows xp and vista also. –  Maddest Hatter Mar 31 '10 at 2:03
    
Im sorry if this is amateurish, but would it be possible for an explanation of how to use the following code? Private Const cPGM = "C:\VB Forum\startup\TestStartup.exe" Dim oShell As IWshShell_Class Set oShell = New IWshShell_Class oShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\MyVBApp", _ cPGM, "REG_SZ" thanks for your patience –  Maddest Hatter Mar 31 '10 at 2:10
    
that will set a registry key that allows "C:\VB Forum\startup\TestStartup.exe" to run at startup –  Remus Rigo Dec 30 '10 at 14:57

5 Answers 5

the simpliest way is to create a shortcut and to drag it it Startup folder (drag over start button, programs, start and drop it there)

If you want to see the path, just r-click on startup folder and select open

share|improve this answer

Yet another method is to use the task scheduler found under accessories/system tools. Create a task that launches the program at startup.

share|improve this answer

C:\Users\YOURUSERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

share|improve this answer
1  
Be wary of non-English versions here!! There are known ways to get special folders under Windows. –  paxdiablo Mar 31 '10 at 2:07
    
I notices the tags didn't include a tag for any programming language so I assumed he just wanted a path. I think maybe his question if not asking for code example should be placed on superuser instead. –  Dremation Mar 31 '10 at 2:13
    
You should still use the environment variables. %AppData%\Microsoft\Windows\Start Menu\Programs\Startup –  Scott Chamberlain Jul 13 at 17:24

There are many options, the Startup folder being only one of them.

A detailed guide is available here: http://oreilly.com/pub/a/oreilly/windows/ron/startup_0401.html

The most popular option these days is the registry - see the guide link above for details.

share|improve this answer
    
That's the answer. You don't need to look any further. –  Anonymous Mar 31 '10 at 2:36

The preferred way is to create a registry entry, such as in HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run. The key needs to be of type REG_SZ (0-terminated string) and contain a unique name as Name and the program's full executable path as Data.

share|improve this answer
1  
I disagree. The registry has less transparency to the average user than the startup folder. Users don't generally like it when programs add startup items of dubious necessity. –  Hugh Allen Mar 31 '10 at 4:33

Your Answer

 
discard

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