Quantcast
Results 1 to 4 of 4

Deleting a specific file when W7 is shut down

  1. #1
    Carlotto is offline Junior Member
    Enjoys Windows 7 Forums
     
    Join Date
    Oct 2012
    Posts
    2
    Windows 7/Server 2008 R2 Chrome 23.0.1270.0

    Question Deleting a specific file when W7 is shut down

    Hello,

    I have some basics of programming but I don’t really know anything about Windows 7 scripting, so here’s my question:

    How can I make it so that a specific file (FNTCACHE.DAT if you’re interested but I doubt it’s important) is deleted everytime I shut down Windows?

    I guess it would have to either be a script which deletes the file when I hit “Shut down” in the start menu or a script which deletes the file then shuts down Windows when run, wouldn’t it?

    Thank you.

    EDIT: I thought I’d give it a try, would this work?
    del "C:\Windows\System32\FNTCACHE.DAT"
    shutdown -s
    Last edited by Carlotto; 10-13-2012 at 05:54 AM.

    Reply With Quote Reply With Quote

  2. #2
    patcooke's Avatar
    patcooke is offline Tier 2 Moderator
    Microsft Most Valuable
    Professional
     
    Join Date
    May 2010
    Age
    67
    Posts
    2,118
    Windows 7/Server 2008 R2 Firefox 11.0

    Re: Deleting a specific file when W7 is shut down

    Was just about to suggest similar: (save in a bat file and create link to it on your desktop)

    del %SystemRoot%\System32\fntcache.dat
    %SystemRoot%\System32\shutdown.exe /s /t 0 /f

    also this option for a restart:

    del %SystemRoot%\System32\fntcache.dat
    "%SystemRoot%\System32\shutdown.exe " /r /t 0 /f

    or this one to log off:

    del %SystemRoot%\System32\fntcache.dat
    %SystemRoot%\System32\shutdown.exe /l
    Last edited by patcooke; 10-13-2012 at 06:07 AM.

    Reply With Quote Reply With Quote

  3. #3
    Carlotto is offline Junior Member Thread Starter Thread Starter
    Enjoys Windows 7 Forums
     
    Join Date
    Oct 2012
    Posts
    2
    Windows 7/Server 2008 R2 Chrome 23.0.1270.0

    Re: Deleting a specific file when W7 is shut down

    Ok, thanks a lot, I will do that.

    Reply With Quote Reply With Quote

  4. #4
    AceInfinity's Avatar
    AceInfinity is offline Member
    Computer Mainstream Pro
     
    Join Date
    Aug 2011
    Posts
    46
    Windows 8 Firefox 17.0

    Re: Deleting a specific file when W7 is shut down

    You don't even need to do what patcooke had mentioned, there's a more automatic way of you have the group policy editor. you can set scripts for when you shutdown,startup, etc... Create the script, and call to it on those events..

    In gpedit.msc:


    There would be no need for this batch script to replace your regular start button then.

    And I would also specify these flags for the delete operation:
    Code:
    del /f/q %SystemRoot%\System32\fntcache.dat

    VB/C# Programming - (2012 - Present)
    ®Crestron - DMC-T Certified Programmer


    ~ "The universe is an intelligence test." - Timothy Leary ~

    Reply With Quote Reply With Quote

Similar Threads

  1. Replies: 0
    Last Post: 04-11-2011, 03:05 PM
  2. Very Slow File Operations- Copying, Deleting
    By Dave McKeen in forum Windows 7 Support
    Replies: 16
    Last Post: 09-27-2010, 08:29 PM
  3. Trying to change specific file type application.
    By tprizler in forum Windows 7 Support
    Replies: 2
    Last Post: 07-03-2010, 04:12 PM
  4. Replies: 2
    Last Post: 03-10-2010, 05:26 AM
  5. DVD File deleting
    By bashar in forum Hardware
    Replies: 0
    Last Post: 02-15-2009, 12:23 PM

Visitors found this page by searching for:

Search engine data is still being processed!

Tags for this Thread

Posting Permissions

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