Set the default behavior for AutoRun: registry value NoAutorunComputerHKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
- Policy ID
- NoAutorun
- Scope
- Computer Configuration, User Configuration
- Supported on
- At least Windows Vista
- Source
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (version 1.0)
- Category
- Windows Components › AutoPlay Policies
Registry
NoAutorun
REG_DWORDComputerUser…\Software\Microsoft\Windows\CurrentVersion\Policies\ExplorerHKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer Current key
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
- Enabled value
- Depends on the option value
- Element
- Default AutoRun Behavior
| Item | Stored value |
|---|---|
| Do not execute any autorun commands | 1 |
| Automatically execute autorun commands | 2 |
Apply with .reg · CMD · PowerShell
ComputerMachine-wide setting
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] ; Options (use only one) ; Do not execute any autorun commands "NoAutorun"=dword:00000001 ; Automatically execute autorun commands "NoAutorun"=dword:00000002
CMD
:: Options (use only one) :: Do not execute any autorun commands reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 1 /f :: Automatically execute autorun commands reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 2 /f
PowerShell
# Common: create the key New-Item -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null # Options (use only one) # Do not execute any autorun commands New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 1 -Force | Out-Null # Automatically execute autorun commands New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 2 -Force | Out-Null
UserPer-account setting
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] ; Options (use only one) ; Do not execute any autorun commands "NoAutorun"=dword:00000001 ; Automatically execute autorun commands "NoAutorun"=dword:00000002
CMD
:: Options (use only one) :: Do not execute any autorun commands reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 1 /f :: Automatically execute autorun commands reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutorun" /t REG_DWORD /d 2 /f
PowerShell
# Common: create the key New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null # Options (use only one) # Do not execute any autorun commands New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 1 -Force | Out-Null # Automatically execute autorun commands New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoAutorun' -PropertyType DWord -Value 2 -Force | Out-Null