Need help with batch file


  1. Posts : 54
    Windows 10 64bit
       #1

    Need help with batch file


    No serious Batch file or scripting experience, so bear with me. We use a site for our business that has to run on IE and has to have the cache cleared a certain way sometimes for it to function.

    We have to go IE options, uncheck delete history on exit - go to delete browsing hisotry and
    uncheck preserve favorites
    check the rest
    delete/apply

    Then we have to go in the IE settings and go to delete browsing hisotry and
    Check preserve favorites
    Uncheck Temp files
    Uncheck cookies

    Delete/apply

    Having end users attempt to follow these directions has been a nightmare and so has manually doing this, either in person or remotely to over 290 pc's.

    All are on Windows 7 pro

    What can I create 2 shortcuts that, when double clicked, will execute those commands?
    I will push the shortcuts via gpo so that part I am good with

    Any help or advice would be great.
      My Computer


  2. Posts : 8,109
    windows 10
       #2

    The best is to use a free program called autoit which is a programing language AutoIt its free and makes writing complex scripts simple you can then compile to an exe and run like any windows app. You will find you can create all sorts of apps very simply see tutor Tutorial - WinZip what makes it so good is can download a macro recorder so you record what you want it then produces the code for you as simple as that lots of video tutors for it Autoit Tutorials Part 2 Record and Play back using AU3Recorder - YouTube
      My Computer


  3. Posts : 54
    Windows 10 64bit
    Thread Starter
       #3

    Thanks, much appreciated, but I am more into learning how to complete these task instead of a program doing it for me.
      My Computer


  4. Posts : 8,109
    windows 10
       #4

    You can use both write the code or use the macro using the macro ois a quick way to learn there are lots of forums and help for it its been about for years and very powerful offering a lot more than cmd files
      My Computer


  5. Posts : 93
    Windows 10
       #5

    Hi,

    Try this,
    Code:
    @echo off
    
    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess Flags:8389627
    
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "ClearBrowsingHistoryOnExit" /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "UseAllowList"            /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanTIF"                /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanCookies"            /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanHistory"            /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanDownloadHistory"    /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanForms"              /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanPassword"           /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanTrackingProtection" /t REG_DWORD /d 1 /f
    Or perhaps a little more complex:
    Code:
    @echo off
    
    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess Flags:8389627
    
    for %%I in (
    	ClearBrowsingHistoryOnExit:0
    	UseAllowList:1
    	CleanTIF:0
    	CleanCookies:0
    	CleanHistory:1 
    	CleanDownloadHistory:1
    	CleanForms:1
    	CleanPassword:1
    	CleanTrackingProtection:1
    ) do (
    	for /f "tokens=1,2 delims=:" %%I in ("%%~I") do (
    		reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "%%~I" /t REG_DWORD /d "%%~J" /f
    	)
    )
      My Computer


  6. Posts : 54
    Windows 10 64bit
    Thread Starter
       #6

    Pyprohly said:
    Hi,

    Try this,
    Code:
    @echo off
    
    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess Flags:8389627
    
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "ClearBrowsingHistoryOnExit" /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "UseAllowList"            /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanTIF"                /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanCookies"            /t REG_DWORD /d 0 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanHistory"            /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanDownloadHistory"    /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanForms"              /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanPassword"           /t REG_DWORD /d 1 /f
    reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "CleanTrackingProtection" /t REG_DWORD /d 1 /f
    Or perhaps a little more complex:
    Code:
    @echo off
    
    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess Flags:8389627
    
    for %%I in (
        ClearBrowsingHistoryOnExit:0
        UseAllowList:1
        CleanTIF:0
        CleanCookies:0
        CleanHistory:1 
        CleanDownloadHistory:1
        CleanForms:1
        CleanPassword:1
        CleanTrackingProtection:1
    ) do (
        for /f "tokens=1,2 delims=:" %%I in ("%%~I") do (
            reg add "HKCU\SOFTWARE\Microsoft\Internet Explorer\Privacy" /v "%%~I" /t REG_DWORD /d "%%~J" /f
        )
    )
    Thanks man! I will give that a shot and report back! Thanks a lot! Not being familiar with this, does this include the "unchecking" of preserve favorites, then rechecking it? I just am not sure how to read them in full and I know we are to keep the "delete browsing history on exit" UNCHECKED. This is just for when they experience a certain issue
      My Computer


  7. Posts : 93
    Windows 10
       #7

    mike6623 said:
    [D]oes this include the "unchecking" of preserve favorites, then rechecking it?
    It just checks it. Because the checks are only a visual thing, only the final state matters. The registry edits handle the checking. If you need a different arrangement of checks, you can change what is to be checked or not by swapping zeros for ones or vice versa according to your needs. A ‘1’ means checked, ‘0’ unchecked.

    The actual clean up operation happens with the RunDll32 command which will clean up browsing history as if all options were checked except “Preserve Favorites website data”. What is actually cleaned up is not configureable. Did you need this to be?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:35.
Find Us




Windows 10 Forums