How to start app at startup ?

Hi friends,

I'm faced with a requirement that is kind of unknown to me.

In my situation, if my application was running and the machine reboots, then I need to start my
application automatically once the machine comes up. If the application was closed by the user
then it should not come up at system reboot next time.

One way to do this could be to write a small program which reads a "status" from a file which
will be written to by the application while it is running. The app would write "Running" when it is executing or "Not Running" when it is closed, to this file. I could then install this program as a windows service to start up automatically at reboot time. There it would check up the
contents of the status file and take appropriate action.

I've heard this can also be achieved through some registry work.

Are there any other ways of doing this What would be the best, easiest and efficent way
of doing this

Thanks n Regards,
Kunal




Answer this question

How to start app at startup ?

  • Abbasi

    Yes you can do this using the registry which would probably be the easiest way, there is a place that you can place a path to an executable that will run at start up, if I was you I would on the start of my program place the path to the exectuable there and then on shutdown of the program you remove it. Then if the program crashes you never had the chance to remove it from the registry so your program starts automatically.

    There are two places you can place this, one is in HKEY_LOCALMACHINE\SOFTWARE\Microsoft\Windows\Run
    or
    HKEY_LOCALUSER\SOFTWARE\Microsoft\Windows\Run

    One will work for just the current user the other will work for any user on the machine.

    I'll let you figure out how to mess with the registry as it's not very hard and you should be able to figure it out.


  • How to start app at startup ?