Below is a video tutorial of turning off Autoplay on Windows 10, Windows XP and Vista, please follow:
Enter gpedit in the search bar to open the Group policy editor.
Next in the left panel of the Local Group Policy Editor window, go to the following order:
Computer Configuration> Administrative Templates> Windows Components> AutoPlay Policies
Look to the right, find Turn off Autoplay and double click on it. Select Enabled , in the Options box, select All drives to turn off on all drives, or just turn off CD drives and removable drives.