You can use the following method to delete the value in the MuiCache
key that contains the path to your application executable.
After that value has been deleted from MuiCache
, browsing to your application via the Windows Open with dialog will re-add the path to your executable to MuiCache
with your updated title.
using Microsoft.Win32;
using System.Linq;
using System.Reflection;
const string MuiCacheKeyPath =
@"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache";
static void DeleteExecutablePathFromMuiCache()
{
string exePath = Assembly.GetExecutingAssembly().Location; // (1)
using (RegistryKey muiCacheKey = Registry.CurrentUser
.OpenSubKey(MuiCacheKeyPath, writable: true))
{
if (muiCacheKey.GetValueNames().Contains(exePath))
{
muiCacheKey.DeleteValue(exePath);
}
}
}
Alternatively, if you want to programmatically update the title directly, instead of DeleteValue(exePath)
, call:
muiCacheKey.SetValue(exePath, yourNewTitle);
(1) From this answer to the question How can I get the application's path in a .NET console application?.