🟣 C# / .NET 6+
Disable Recent Documents History (C#)
Stops Windows from tracking recently opened documents. Applies the tweak via Microsoft.Win32.Registry.
SetDisableRecentDocsHistory.cs
// SetDisableRecentDocsHistory.cs
//
// Disable Recent Documents History.
// Stops Windows from tracking recently opened documents.
//
// Usage: dotnet new console -o SetDisableRecentDocsHistory, 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("NoRecentDocsHistory", 1, RegistryValueKind.DWord);
Console.WriteLine("Disable Recent Documents History applied.");