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

  • 相关阅读:
    jquery-5 jQuery筛选选择器
    百度富文本编辑器ueditor使用启示
    前端开发思路
    世界硬币:比特币类似的评分系统!
    百度面试题 号码找到符合条件
    彩色图像--色彩空间 YIQ 、YUV 、YCbCr 、YC1C2 和I1I2I3
    HDU 4915 Parenthese sequence
    Visual FoxPro 6.0~9.0解决方案和实例文档和CD写入原件下载
    DWR入门的例子(一个)
    写自己的第二级处理器(3)——Verilog HDL行为语句
  • 原文地址:https://www.cnblogs.com/qixue/p/1880688.html
Copyright © 2011-2022 走看看