我使用以下脚本删除IE 7.0中的浏览历史记录
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
但现在我需要一个脚本来清除IE 6.0中的浏览历史记录
我收到错误“缺少条目ClearMyTracksByProcess”我已经传递了不同的参数,如2,5等,但没有成功。
答案 0 :(得分:3)
// 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;
}
答案 1 :(得分:2)
由于Internet Explorer 7附带的INETCPL.CPL version 7.0
确实有一个名为ClearMyTracksByProcessW
的入口点,因此它可能不存在于IE6中。
因此,脚本可能是一个更基本的解决方案:
@ECHO OFF
ECHO * Cleaning Current User's Temp Folders *
FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Cookies\*.*"
FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\Temp\*.*"
FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\History\*.*"
FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\Temporary Internet Files\*.*"
Echo * Done *
PAUSE
CLS
(您只能在此脚本中保留您感兴趣的“删除”)
但是,作为reported in this thread,可能还不够。
唯一的其他解决方案是使用(免费)第三方实用程序:
alt text http://www.ccleanerbeginnersguide.com/ccleanerhelp.png CCleaner
答案 2 :(得分:0)
ClearMyTracks()不是IE6的一部分,所以你不能做同样的伎俩。
如果您只想清除历史记录,可以编写一个只有CoCreates(CLSID_CUrlHistory,IID_IUrlHistoryStg2)的小程序,然后调用IUrlHistoryStg::ClearHistory()。
也应该能够从VBScript中做到这一点,但我不知道正确的魔力。
答案 3 :(得分:0)
民间坏消息
尝试使用带有IE8 / 9的Win 7上的ClearMyTracksByProcess删除Internet历史记录不再有效,并且您只能通过在启动时运行dos delete命令来清理某些文件,因为microsoft使用超级隐藏文件夹,锁定文件,以及它很大混乱和打乱老大哥。
此代码清除IE8 / 9以及FireFox和共享对象/ flash cookie但如果要删除Index.dat文件,请单击我的名称以查看代码。
using System;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Text;
namespace Fidling
{
public static class SpywareRemoval
{
private static void RemoveSpywareFiles(string RootPath, string Path,bool Recursive)
{
string FullPath = RootPath + Path + "\\";
if (Directory.Exists(FullPath))
{
DirectoryInfo DInfo = new DirectoryInfo(FullPath);
FileAttributes Attr = DInfo.Attributes;
DInfo.Attributes = FileAttributes.Normal;
foreach (string FileName in Directory.GetFiles(FullPath))
{
RemoveSpywareFile(FileName);
}
if (Recursive)
{
foreach (string DirName in Directory.GetDirectories(FullPath))
{
RemoveSpywareFiles("", DirName, true);
try { Directory.Delete(DirName); }catch { }
}
}
DInfo.Attributes = Attr;
}
}
private static void RemoveSpywareFile(string FileName)
{
if (File.Exists(FileName))
{
try { File.Delete(FileName); }catch { }//Locked by something and you can forget trying to delete index.dat files this way
}
}
private static void DeleteFireFoxFiles(string FireFoxPath)
{
RemoveSpywareFile(FireFoxPath + "cookies.sqlite");
RemoveSpywareFile(FireFoxPath + "content-prefs.sqlite");
RemoveSpywareFile(FireFoxPath + "downloads.sqlite");
RemoveSpywareFile(FireFoxPath + "formhistory.sqlite");
RemoveSpywareFile(FireFoxPath + "search.sqlite");
RemoveSpywareFile(FireFoxPath + "signons.sqlite");
RemoveSpywareFile(FireFoxPath + "search.json");
RemoveSpywareFile(FireFoxPath + "permissions.sqlite");
}
public static void RunCleanup()
{
try { KillProcess("iexplore"); }
catch { }//Need to stop incase they have locked the files we want to delete
try { KillProcess("FireFox"); }
catch { }//Need to stop incase they have locked the files we want to delete
string RootPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal).ToLower().Replace("documents", "");
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\#SharedObjects",false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\#local", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temporary Internet Files", false);//Not working
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.Cookies), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.History), true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Wer", true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Caches", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\WebsiteCache", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temp", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Microsoft\CryptnetUrlCache", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Apple Computer\QuickTime\downloads", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Mozilla\Firefox\Profiles", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Microsoft\Office\Recent", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Adobe\Flash Player\AssetCache", false);
if (Directory.Exists(RootPath + @"\AppData\Roaming\Mozilla\Firefox\Profiles"))
{
string FireFoxPath = RootPath + @"AppData\Roaming\Mozilla\Firefox\Profiles\";
DeleteFireFoxFiles(FireFoxPath);
foreach (string SubPath in Directory.GetDirectories(FireFoxPath))
{
DeleteFireFoxFiles(SubPath + "\\");
}
}
}
private static void KillProcess(string ProcessName)
{//We ned to kill Internet explorer and Firefox to stop them locking files
ProcessName = ProcessName.ToLower();
foreach (Process P in Process.GetProcesses())
{
if (P.ProcessName.ToLower().StartsWith(ProcessName))
P.Kill();
}
}
}
}
答案 4 :(得分:0)
我会帮你解决这个问题.. 这就是我自己使用的。
我召唤一个提示框,根据需要进行编辑
@echo off
echo.
echo Clearing History
echo Please close this window if opening this was a mistake.
pause
echo.
echo Clearing History: File Explorer
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*
Del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*
REG Delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /VA /F
REG Delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths /VA /F
echo.
echo Completed!
echo.
echo -----------------------------------------------------------------------------------
echo.
echo Clearing History: Firefox
echo.
echo Scanning for 'Firefox' data
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
IF NOT EXIST "%DataDir%" GOTO NOFIREFOXDIR
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
GOTO YESFIREFOXDIR
:NOFIREFOXDIR
echo.
echo Firefox NOT found!
echo.
GOTO CHROMESETUP
:YESFIREFOXDIR
echo.
echo Completed!
echo.
:CHROMESETUP
echo -----------------------------------------------------------------------------------
echo.
echo Clearing History: Google Chrome
echo.
echo Scanning for 'Google Chrome' data.
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data
IF NOT EXIST "%ChromeDir%" GOTO NOCHROMEDIR
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
GOTO YESCHROMEDIR
:NOCHROMEDIR
echo.
echo Google Chrome NOT found!
echo.
GOTO OPERASETUP
:YESCHROMEDIR
echo.
echo Completed!
echo.
:OPERASETUP
echo -----------------------------------------------------------------------------------
echo.
echo Clearing History: Opera
echo.
echo Scanning for 'Opera' data.
set OperaDir=C:\Users\%USERNAME%\AppData\Local\Opera\Opera
set OperaDir2=C:\Users\%USERNAME%\AppData\Roaming\Opera\Opera
IF NOT EXIST "%OperaDir%" GOTO OPERA2
del /q /s /f "%Opera%"
rd /s /q "%Opera%"
:OPERA2
IF NOT EXIST "%OperaDir2%" GOTO NOOPERADIR
del /q /s /f "%Opera2%"
rd /s /q "%Opera2%"
GOTO YESOPERADIR
:NOOPERADIR
echo.
echo Opera NOT found!
echo.
GOTO APPLESETUP
:YESOPERADIR
echo.
echo Completed!
echo.
:APPLESETUP
echo -----------------------------------------------------------------------------------
echo.
echo Clearing History: Apple Safari
echo.
echo Scanning for 'Apple Safari' data.
set AppleDir=C:\Users\%USERNAME%\AppData\Local\Applec~1\Safari
set AppleDir2=C:\Users\%USERNAME%\AppData\Roaming\Applec~1\Safari
IF NOT EXIST "%AppleDir%" GOTO APPLESETOP
del /q /s /f "%AppleDir%\History"
rd /s /q "%AppleDir%\History"
del /q /s /f "%AppleDir%\Cache.db"
del /q /s /f "%AppleDir%\WebpageIcons.db"
:APPLESETOP
IF NOT EXIST "%AppleDir2%" GOTO NOAPPLEDIR
del /q /s /f "%AppleDir2%"
rd /s /q "%AppleDir2%"
GOTO YESAPPLEDIR
:NOAPPLEDIR
echo.
echo Apple Safari NOT found!
echo.
GOTO INTESETUP
:YESAPPLEDIR
echo.
echo Completed!
echo.
:INTESETUP
echo -----------------------------------------------------------------------------------
echo.
echo Clearing History: Microsoft Internet Explorer
echo.
echo Scanning for 'Microsoft Internet Explorer' data.
set IEDataDir=C:\Users\%USERNAME%\AppData\Local\Microsoft\Intern~1
IF NOT EXIST "%IEDataDir%" GOTO HISTORYDIR
del /q /s /f "%IEDataDir%"
rd /s /q "%IEDataDir%"
:HISTORYDIR
set History=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\History
IF NOT EXIST "%History%" GOTO IETEMPDIR
del /q /s /f "%History%"
rd /s /q "%History%"
:IETEMPDIR
set IETemp=C:\Users\%USERNAME%\AppData\Local\Microsoft\Windows\Tempor~1
IF NOT EXIST "%History%" GOTO COOKIESDIR
del /q /s /f "%IETemp%"
rd /s /q "%IETemp%"
:COOKIESDIR
set Cookies=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies
IF NOT EXIST "%Cookies%" GOTO FLASHCCC
del /q /s /f "%Cookies%"
rd /s /q "%Cookies%"
:FLASHCCC
set FlashCookies=C:\Users\%USERNAME%\AppData\Roaming\Macromedia\Flashp~1
IF NOT EXIST "%FlashCookies%" GOTO FINAL
del /q /s /f "%FlashCookies%"
rd /s /q "%FlashCookies%"
:FINAL
echo.
cls
echo.
echo Thank you for using our cleaner...
echo.
pause