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

  • 相关阅读:
    Core Animation简介
    objective-c 常用函数、变量
    NSString判断纯数字
    自定义对话框AlterView
    IOS 6 自动布局 入门-1(IOS中autolayout和之前版本autoresize的差异)
    真机调试问题 错误集合
    block使用小结、在arc中使用block、如何防止循环引用
    View和viewController的生命周期
    IOS侧滑和webview
    Linker Error、MRC与ARC、导航条背景
  • 原文地址:https://www.cnblogs.com/qixue/p/1880688.html
Copyright © 2011-2022 走看看