c++ program open at startup

Please tell me the shortest code to make a c++ run itself at startup.
There is not an easy cross platform way I believe, but for Windows:

You need to mention the compiled executable in the registry (HKLM\...\Run or HKCU\...\Run) or locate the executable in %UserProfile%\AppData\...\Startup.

Using the WinAPI, you can do the first idea through a registry call, but I believe that you need the name the compiled exe will have after compilation. You'll also need it to create a shortcut in the Startup folder to do it the other way.
how will i do your first method?
but i need in such a way that the program itself copies itself onto a folder without the user doing anything.
Last edited on
Registered users can post here. Sign in or register to post.