public static bool AddRegistryKeyValue(RegistryHive hive, string path, string name, string value, bool addQuotes = false) => RegistryKey.OpenBaseKey(hive, RegistryView.Registry64).OpenWritableSubKeySafe(path, key => { if (addQuotes && !value.StartsWith("\"") && !value.EndsWith("\"")) value = "\"" + value + "\""; key.SetValue(name, value); return true; });