There is an easy way to enable or disable autoplay in Windows 8.1 whenever a media/device is inserted.
To do this :
Access the Windows charm bar and go to Settings > Change PC settings.
From “PC settings”, select “PC and devices” and go to “Autoplay”. Then simply turn on/off the slider next to “Use Autoplay for all media and devices”.