🖥️ Batch (CMD)

Disable Autoplay for All Drives (Batch)

Disables Autoplay prompts for every drive type, including USB. Applies the tweak via reg.exe.

By WindowsScripting.com · 581 B
SetDisableAutoplayAllDrives.bat
@echo off
:: ============================================================
:: SetDisableAutoplayAllDrives.bat
::
:: Disable Autoplay for All Drives.
:: Disables Autoplay prompts for every drive type, including USB.
:: ============================================================

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d "255" /f

if %ERRORLEVEL% EQU 0 (
    echo Disable Autoplay for All Drives applied.
) else (
    echo Failed to apply tweak. Try running this script as Administrator.
)
pause