Thanks to: how to geek.com
Most people can disable AutoPlay from the Settings or Control Panel, and they won’t need any further options. However, if you have Windows 10 Pro and want to disable AutoPlay for multiple users on the same computer, you can disable it through the Group Policy Editor.
Press “Win + R” to open the Run box and type “gpedit.msc.” Under “Computer Configuration > Administrative Templates > Windows Components”, click “AutoPlay Policies”.
In the right-hand side details pane, double click “Turn off AutoPlay” to open the Properties box. Click “Enabled,” and then select “All drives” in the “Turn off AutoPlay” on box to disable AutoPlay on all drives or choose choose “CD-ROM and removable media drives” to disable AutoPlay on these medias.
Turning off AutoPlay is incredibly easy, but if you take the time to configure it, it can be a pretty helpful feature. Note, however, that the most secure option is to set AutoPlay set to “Ask me everytime” if you prefer to keep AutoPlay enabled. This way nothing will automatically open. But if you trust everything you plug into your computer, AutoPlay can be quite convenient.