Search code examples
windowsdirectoryregistrystartup

Windows - How to change the startup programm directory


Problem: I was changing startup programs. Changes were successful and everything worked fine. Until one day after restarting the computer startup apps got reset and then I got a new folder on the front of my desktop.

Folder: <Desktop>/Backup/Default/Startup/

And this folder now is used as the default startup application directory. If I delete this directory startup applications just break and do not show up anymore in the task manager and I am not able to disable any of them.

What I want: To remove this folder from my desktop and change the directory of the startup applications to the default one or any other than the folder on the desktop. And to be able to change the startup programs once again.

What I have tried: Reinstalling windows (keeping the user files installation). Installing windows from the local version I had and downloaded a clean installation. Deleting both directories (Folder on desktop and the actual startup app directory) and restarting the computer to reset everything. It seems to me that this directory is linked to my windows account (Wiping the windows configuration for the account did not fix the issue).

Idea I currently have: If I am not mistaken, there should be a windows registry entry that is responsible for the location of this folder/directory. Maybe someone is aware of this value that could be changed to move this folder from my desktop. Or maybe there is another approach to fix this issue. Any idea would be appreciated.


Solution

  • Yes there is a registry value but since you asked on Stackoverflow the proper answer is going to be programmatic.

    To restore the default, do something like

    PWSTR path = 0;
    HRESULT hr = SHGetKnownFolderPath(FOLDERID_Startup, KF_FLAG_DONT_VERIFY|KF_FLAG_DEFAULT_PATH, 0, &path);
    if (SUCCEEDED(hr))
    {
      SHGetKnownFolderPath(FOLDERID_Startup, 0, 0, path);
    }
    CoTaskMemFree(path);