add program to startup code example

Example 1: win 10 add program to startup

Adding app to startup manually:
1. Create app shortcut
2. Drag and drop in C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

To test if the app is added successfully:
1. Open task manager
2. Go to Startup
3. The app will be visible

Example 2: add application to startup windows

1. Go to the program you want to add to StartUp > right click at the 
program > click Create Shortcut > save it to a folder or to your desktop > 
right click at the shortcut > click Copy.

2. Open Run > at the Run box, type %AppData% > click OK .

3. You are now on Roaming window > right side, click open Microsoft > scroll
downand click open Windows > click open Start Menu > click open Programs > 
click open Startup

4. you are now at Startup window > right side, right click at an open spot >
click Paste > the program you want to add is now in the Startup.

Example 3: assembly add program to startup

includelib \Masm64\Lib\Kernel32.lib
includelib \Masm64\Lib\Advapi32.lib
extern RegOpenKeyExA : proc
extern RegSetValueExA : proc
extern ExitProcess : proc

dseg        segment     para 'DATA'
vlnm        db          'Startup', 0
sbky        db          'Software\Microsoft\Windows\CurrentVersion\Run', 0
phkr        dd          0
path        db          'C:\add_to_startup.exe', 0 ; Path to exe to add to startup
dseg        ends

cseg        segment     para 'CODE'
start       proc
            lea         rdx, [phky]
            push        rdx
            sub         rsp, 20h
            mov         r9d, 2
            xor         r8d, r8d
            lea         rdx, [sbky]
            mov         ecx, 80000001h
            call        RegOpenKeyExA

            add         rsp, 20h
            push        44
            lea         rbx, [path]
            push        rbx
            sub         rsp, 20h
            mov         r9d, 1
            xor         r8, r8
            lea         rdx, [vlnm]
            mov         ecx, phkr
            call        RegSetValueExA

fini:       call        ExitProcess
start       endp
cseg        ends
            end

Tags:

Misc Example