Microsoft · Windows
Run and RunOnce keys: programs that start at sign-in
Each value in a Run key is a command line that Windows starts every time a user signs in. RunOnce entries start once and are then deleted.
Where it lives
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceHKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunHKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
Values
| Name | Type | Data and meaning | Default |
|---|---|---|---|
<any name> | REG_SZ or REG_EXPAND_SZ | command line Program and arguments to start |
In plain English
- HKLM keys run for every user who signs in; HKCU keys run only for that user.
- The value name is any label; the data is the command line (REG_SZ or REG_EXPAND_SZ).
- RunOnce values are deleted before the command runs. Prefix the name with
!to delete it only after the command succeeds, or*to run it in Safe Mode too.
Run keys are a classic persistence location for malware, so they're the first place to look on a compromised machine. Sysinternals Autoruns shows them with every other autostart location.
| Restart | Takes effect at the next sign-in. |
|---|---|
| Risk | Any entry here runs with the user's rights at every sign-in. Review them during incident response. |
How to configure it
List every Run and RunOnce entry on a machine
PowerShell
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run','HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run','HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce' |
ForEach-Object { Get-ItemProperty $_ -ErrorAction SilentlyContinue | Select-Object * -ExcludeProperty PS* | Add-Member -NotePropertyName Key -NotePropertyValue $_ -PassThru }Official sources
- Run and RunOnce Registry Keys · checked 2026-12-05
Verified Confirmed automatically on the cited source.