嗨所以我想删除的运行历史记录当用户按下的Windows + R键所以没有病史我给这个方法,你会看到的参数,这是HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
如何删除注册表中的值?
但我很担心,我会删错了项目,这是我的代码:
//this method will clear the run history from the registry
private void ClearRunHistory(string RegRunHistoryDirectory)
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(RegRunHistoryDirectory, true))
{
if (key == null)
{
//if key doesnt exist then do nothing
}
else
{
key.DeleteValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU");
}
}
}
在什么意义上你担心你会删除错误的注册表项?你问:“这是存储运行历史记录的注册表项?”,还是你问“我的代码是否有可能删除不同的注册表项”? –