Jump to content

cleanup.cmd not working


Recommended Posts

Hi

I have some problems with my cleanup.cmd.

I want to delete all files in the %TEMP% (%tmp%) directory... and it does not work :

cmdow @ /HID

shutdown.exe -r -f -t 90 -c "Reboot..."

DEL /S /Q "%windir%\Temp\" //deleting windows temp : ok

DEL /S /Q "%TMP%" // deleting current user's (administrator) temp : Not working

DEL /S /Q "%TEMP%" //same

exit

When i try to do the same commands under xp it works :/

Link to comment
Share on other sites


Because.....

In the commands before it, the directories have been removed, therfore, new empty ones are created in their place.

You don't delete a directory, you remove them. If you want another option, you can CD to %TEMP% and %TMP% and then del *.*

Link to comment
Share on other sites

Here A VBS script that might work

on error resume next
Set Shell = WScript.CreateObject("WScript.Shell")
WD = Shell.ExpandEnvironmentStrings("%Windir%")
T1 = Shell.ExpandEnvironmentStrings("%tmp%")
T2 = Shell.ExpandEnvironmentStrings("%temp%")
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile( T1)
fso.DeleteFile( T2 )
fso.DeleteFile( WD & "\Temp")
'''wasnt sure if you want to remove the files or folder
fso.DeleteFolder( T1)
fso.DeleteFolder( T2 )
fso.DeleteFolder WD & "\Temp")

Edited by gunsmokingman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...