zoukankan      html  css  js  c++  java
  • How to clear windows run line history

    This history of command is stored in a per user key in registry database. One can clear this command history by cleaning up the entries under this registry key.

    This registry key is

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU

    So to cleanup command history we can simply run the below command from command prompt.

    reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f 


    Note that after running the above command you would still be able to see history for the current login session. Once you logoff and login back you won't be able to see the history.

    A few days ago when I looking throught the net articles, i saw a good boy wrote a VBS tool that can clear the regedit nodes, it really easy to use:

    'Run历史记录清理工具     愚人陈    2010/3/21 5:47
    '
    'left命令
    'reg相关命令
    'Err.Clear
    'Input false
    '-----------------------------------------------------------------------
    Set r=CreateObject("WScript.Shell")
    Dim a(30),List,Key

    Key = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\"

    Do
    read()
    Loop Until delete()=false

    Function read()
    List=""
    For i=1 To 26
    KeyName=Chr(96+i)
    On Error Resume Next
    RunMRU=r.RegRead (Key&KeyName)
    a(i)=RunMRU
    RunMRU=Left(RunMRU,Len(RunMRU)-2) '剪掉每个键值后面附加的/1
    If Err.Number=0 Then
        List=List&KeyName&" "&RunMRU&Chr(10)
    End If
    Next

    End Function
    'MsgBox list

    Function delete()
    b=InputBox(List&"请输入要删除的项编号,例如abc","Run历史记录清理工具")
    delete=b
    i=1
    MRUList=r.RegRead (key&"MRUList")

    Do Until Mid(b,i,1)=""
    KeyName = Mid(b,i,1)
    'MsgBox KeyName
    On Error Resume Next
    MRU=Split(MRUList,CStr(KeyName),-1)
    Err.Clear
    MRUList=MRU(0)&MRU(1)
    If Err.Number<>0 Then
    MsgBox Cstr(Err.Number)&Err.Description&Chr(10)&"这可能是输入错误造成的"
    Err.Clear
    End If
    'MsgBox MRUList


    r.Regdelete (key&KeyName)
    If Err.Number<>0 Then
    MsgBox "Error #"&CStr(Err.Number)&" "&Err.Description&"可能此项不存在"
    Err.Clear
    End If
    r.RegWrite Key&"MRUList",MRUList
    i=i+1
    loop
    End Function

  • 相关阅读:
    记一次简单的正则表达式匹配实践
    使用readlines()读取文件时出现/n及其解决办法
    浅谈http和https
    JVM GC回收原理的认识
    Mysql中语言分类和区别
    关于storm程序性能压测记录及总结
    Java 集合框架
    MySQL binlog底层主从同步原理
    Docker-Compose安装
    gcc手动安装
  • 原文地址:https://www.cnblogs.com/qixue/p/1880688.html
Copyright © 2011-2022 走看看