+ Reply to Thread
Results 1 to 9 of 9

A simple bat that will delete itself after running

Hybrid View

  1. #1
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,051

    Re: A simple bat that will delete itself after running

    I wonder how many members even know how to code in DOS, let alone what a BAT file is?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  2. #2
    Forum Contributor
    Join Date
    06-23-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    239

    Re: A simple bat that will delete itself after running

    @ck76 Thank you for answering back your input was knid but it didn't work.

    
    echo off
    
    echo Cleaning system junk files, please wait…
    REM displays a line of text
    
    del /f /s /q %systemdrive%\*.tmp
    del /f /s /q %systemdrive%\*._mp
    del /f /s /q %systemdrive%\*.log
    del /f /s /q %systemdrive%\*.gid
    del /f /s /q %systemdrive%\*.chk
    del /f /s /q %systemdrive%\*.old
    del /f /s /q %systemdrive%\recycled\*.*
    del /f /s /q %windir%\*.bak
    del /f /s /q %windir%\prefetch\*.*
    rd /s /q %windir%\temp & md %windir%\temp
    del /f /q %userprofile%\cookies\*.*
    del /f /q %userprofile%\recent\*.*
    del /f /s /q “%userprofile%\Local Settings\Temporary Internet Files\*.*”
    del /f /s /q “%userprofile%\Local Settings\Temp\*.*”
    del /f /s /q “%userprofile%\recent\*.*”
    
    REM /f: force deleting of read-only files
    REM /s: Delete specified files from all subdirectories.
    REM /q: Quiet mode, do not ask if ok to delete on global wildcard
    REM %systemdrive%: drive upon which the system folder was placed
    REM %windir%: a regular variable and is defined in the variable store as %SystemRoot%. 
    REM %userprofile%: variable to find the directory structure owned by the user running the process
    
    
    ipconfig /release 
    ipconfig /renew 
    ipconfig /flushdns
    ipconfig /registerdns 
    TIMEOUT /T 10
    echo Cleaning of junk files is finished!
    shutdown -r -f -t 30 /C "Applying Changes" 
    
    ECHO.
    ECHO Removing CleanUp utility...
    REM Delete self on Exit
    START /b "" cmd /c DEL "%TEMP%\Total_Clean_1.bat" cmd /k DEL "%~f0"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 08-13-2019, 12:58 AM
  2. [SOLVED] Large file size on a simple excel file
    By FieldHaven in forum Excel General
    Replies: 2
    Last Post: 11-16-2014, 01:59 AM
  3. VBA Code for Killing File if File Location Changes (How To?)
    By Jaccobk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2012, 02:50 PM
  4. Killing a file that is open
    By jeffbg123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2010, 01:02 PM
  5. Simple chart!!! This is killing me!
    By brad.tho in forum Excel Charting & Pivots
    Replies: 12
    Last Post: 09-17-2008, 03:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1