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

  • 相关阅读:
    编译nginx增加fair模块
    使用CentOS8来部署php7.4
    通过PHP代码将大量数据插入到Sqlite3
    不同程序语言处理加密算法的性能对比(PHP/Golang/NodeJS)
    CentOS8更换国内YUM源
    MySQL获取上月第一天、上月最后日、本月第一天、本月最后日的方法
    GO
    Go-数据类型以及变量,常量,函数,包的使用
    GO语言介绍以及开发环境配置
    利用python代码操作git
  • 原文地址:https://www.cnblogs.com/qixue/p/1880688.html
Copyright © 2011-2022 走看看