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

  • 相关阅读:
    JS函数浅析(一)
    H5_canvas与svg
    h5+js视频播放器控件
    【BZOJ3622】已经没有什么好害怕的了
    【9.29 模拟】T3 小清新最优化(easy)
    9.27模拟
    9.26 模拟
    4062 -- 【清华集训2012】串珠子
    【SNOI2017】炸弹
    P3216 [HNOI2011]数学作业
  • 原文地址:https://www.cnblogs.com/qixue/p/1880688.html
Copyright © 2011-2022 走看看