windows - 使用脚本清除 Internet Explorer 6.0 浏览历史记录

标签 windows internet-explorer batch-file

我正在使用以下脚本删除 IE 7.0 中的浏览历史记录

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

但现在我需要一个脚本来清除 IE 6.0 中的浏览历史

我收到“缺少条目 ClearMyTracksByProcess”的错误 我已经传递了不同的参数,如 2、5 等,但没有成功。

最佳答案

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "test.h"
#include <shlguid.h> // Needed for CLSID_CUrlHistory
#include <urlhist.h> // Needed for IUrlHistoryStg2 and IID_IUrlHistoryStg2

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    int nRetCode = 0;

    // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
        // TODO: change error code to suit your needs
        _tprintf(_T("Fatal Error: MFC initialization failed\n"));
        nRetCode = 1;
    }
    else
    {
        // TODO: code your application's behavior here.

        IUrlHistoryStg2* pHistory;  // We need this interface for clearing the history.
        HRESULT hr;
        DWORD cRef;
        CoInitialize(NULL);
        // Load the correct Class and request IUrlHistoryStg2
        hr = CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_INPROC_SERVER,
        IID_IUrlHistoryStg2, reinterpret_cast<void **>(&pHistory));

        if (SUCCEEDED(hr))
        {
         // Clear the IE History
         hr = pHistory->ClearHistory();
        }
        // Release our reference to the 
        cRef = pHistory->Release();
        CoUninitialize();
    }

    return nRetCode;
}

关于windows - 使用脚本清除 Internet Explorer 6.0 浏览历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/503068/

相关文章:

node.js - 如何通过终端(ubuntu 或 windows)查找 google chrome 或 firefox tab url?

c++ - 在 Windows 启动修复期间执行代码/脚本

c# - 替换 WebBrowser browser = new WebBrowser();使用 Chrome 实例而不是使用 ie

windows - 通过cmd文件在csv文件末尾追加时间

batch-file - 使用批处理文件在 VSCode 中打开项目

python - multiprocessing.pool.imap 是否有允许多个参数的变体(如星图)?

windows - 如何在Windows PE 32位可执行文件中为代码洞穴腾出空间

css - MS IE 7 中的圆 Angular - 在 Intranet 上无法访问外部世界 - 并且没有 JS/HTC

internet-explorer - Internet Explorer 6 测试

c# - 文件输入和输出