Disable AutoPlay in Windows 10 operating systems is by doing it through Windows Settings. Follow the below-mentioned steps to turn off the AutoPlay in Windows 10:
Step 1: Click Windows icon, in your system.

Step 2: Now, from the menu that pops up, select Settings option

Step 3: Now select Devices (Bluetooth, printers, mouse) options from the Settings menu.

Step 4: Select AutoPlay from the left side pane.

Step 5: Now, turn off the AutoPlay (Use AutoPlay for all media and devices) switch by making a click with your mouse.
Source: Three Methods to Disable AutoRun in Windows 10 (nucleustechnologies.com)