// SetDisableAutoplayAllDrives.cs // // Disable Autoplay for All Drives. // Disables Autoplay prompts for every drive type, including USB. // // Usage: dotnet new console -o SetDisableAutoplayAllDrives, replace Program.cs with this // file, then dotnet run. using System; using Microsoft.Win32; using RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"); key.SetValue("NoDriveTypeAutoRun", 255, RegistryValueKind.DWord); Console.WriteLine("Disable Autoplay for All Drives applied.");