Disable USB AutoRun via the Registry
Turn off automatic execution for removable drives so inserted USB sticks never launch anything.
01Command
$ reg add "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesExplorer" /v NoDriveTypeAutoRun /t REG_DWORD /d 255 /f02What it does
AutoRun was designed for convenience but became the infection vector of countless USB-borne worms, which is why modern Windows already limits it. Setting NoDriveTypeAutoRun to 255 disables it for every drive type, so plugging in a USB stick only opens Explorer or nothing at all. The default value 145 restores normal behavior.
03Risk
04Undo
$ reg add "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesExplorer" /v NoDriveTypeAutoRun /t REG_DWORD /d 145 /f05Sources
- Disable Autoplay - security policy settingEvidence: Documents the NoDriveTypeAutoRun setting and its values for disabling AutoPlay/AutoRun across drive types.
Last verified: 2026-09-18 · Category: Security & Privacy
06Related solutions
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
Two-step command sequence that makes you the owner of a locked file tree and grants yourself full control — the standard fix for 'Access is denied' on old profiles and OS reinstall leftovers.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.