Windows 7 Deleting a specific file when W7 is shut down

Carlotto

New Member
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:
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:
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:
8ejqa.png


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
 
Back
Top