Wednesday, October 19, 2011

Auto Run your exe on OS logon

While we are at it (Your exe and nothing else), I want to show now here the ways to make your exe sort of auto run during logon, the places where we can do that and the advantages and disadvantages if any.

There are 3 common places I would choose to ensure that my exe will auto-load so users will no longer need to double-click it when they open their computer unit.  I will start the sequence from the first to the last:

a.  Startup folder - this is the very first instance that the OS will load or try to run anything.  You can put the shortcut of your exe here.  Click Start button, All Programs (or simply Programs), then Startup folder.  Right-click it and choose Explore.  Paste your exe shortcut here. 

As I said, the OS will try to run "first" what is here before the other ways I will show below and this is a sort of advantage.  Its disadvantage is a user can delete that shortcut later removing that auto-run(load) effect you want your exe to have.

b.  You can create an entry inside registry in this:


Right-click, New, String value, type a name representing your exe, double-click it and on its value data type the full path of your exe (of course including your exe name).  This is the 2nd in sequence.

c.  You can use Winlogon entry as I have shown in Your exe and nothing else blog.  The only difference is we will still use Explorer.exe as the OS shell but will use the same to load our exe immediately upon logon.  So in:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell

Double-click it and on its value, place

EXPLORER.EXE < your exe with full path >

What it will do is use Explorer.exe (default) as its shell then calls your exe after that.

We can also use the startupreg folder in Shared Tools but that would require you to enter more lines so I am not including that here among the options.

As for doing it programmatically, check Your exe and nothing else blog.

The advantage of b and c above over a is that users cannot easily delete your shortcut.


No comments:

Post a Comment