1

I want to get the list of application which runs on windows startup programatically.

i see those application in msconfig->startup.

but when i see it in C:\User\Appdata\Microsoft\windows\start menu\programs\startup

it shows folder is empty.

How to get those list of startup applications programatically C#.

Amiram Korach
  • 13,056
  • 3
  • 28
  • 30
omkar patade
  • 1,442
  • 9
  • 34
  • 66
  • 1
    That's not the only place to config startup programs. There are some registry lists also. Look here http://alperguc.blogspot.co.il/2008/11/c-wmi-startup-programs-list-startup.html – Amiram Korach Nov 01 '12 at 16:13
  • 1
    http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/99511f2a-9e92-408e-8278-f80d4c3b3316 Read this – Nathan Cooper Nov 01 '12 at 16:13

2 Answers2

5

Those in msconfig that you see are in the registry, although they are not all there is. You can try read

/Software/Microsoft/Windows/CurrentVersion/Run

and

/Software/Microsoft/Windows/CurrentVersion/RunOnce

In both HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER

You can find information about those at MSDN and support.microsoft.

Try the article Read, write and delete from registry with C# at CodeProject to get you started with the registry.

Now, as I said above, they are not all there is. Listing those will still miss services and drivers, and also some other code that will start async, such as Explorer extensions, Control Panel extensions, codecs for audio and video among others. All that without considering that the client machine may not use explorer as shell.

I recommend you to have a look at autoruns at sysinternals. You can also use its command line tool to get the info you want.

Theraot
  • 31,890
  • 5
  • 57
  • 86
4

There is a good article: Understand and Control Startup Apps with the System Configuration Utility.

Also there is a great tool to view listing of all startup programs: Autoruns.

For example, you can enumerate string values of the HKLM\Software\Microsoft\Windows\CurrentVersion\Run key:

const string runKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
using (RegistryKey startupKey = Registry.LocalMachine.OpenSubKey(runKey))
{
    var valueNames = startupKey.GetValueNames();

    // Name => File path
    Dictionary<string, string> appInfos = valueNames
        .Where(valueName => startupKey.GetValueKind(valueName) == RegistryValueKind.String)
        .ToDictionary(valueName => valueName, valueName => startupKey.GetValue(valueName).ToString());
}