Jump to content

Recommended Posts

Posted

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 :/


Posted

Well not sure... but the main difference between your first command and the 2 other one.... is the final \ added to the end of the command.....

Did you tried it?

Posted
try: Del /S "%TEMP%" /Q and: Del /S "%TMP%" /Q

i'll try but i dont see the difference between /s /q and /s file /q

Posted

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 *.*

Posted
asbsamsf, Why would you add a "make directory" command to a cleanup.cmd file?

because RD /s/q command will remove all files and folders including the root folder

Posted

well i hope it doesnt change the permission settings (access right)...

And deltree does not work :wacko:

Windows shell really su**

Posted (edited)

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

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...