hfrfc Posted February 11, 2005 Posted February 11, 2005 HiI have some problems with my cleanup.cmd.I want to delete all files in the %TEMP% (%tmp%) directory... and it does not work :cmdow @ /HIDshutdown.exe -r -f -t 90 -c "Reboot..."DEL /S /Q "%windir%\Temp\" //deleting windows temp : okDEL /S /Q "%TMP%" // deleting current user's (administrator) temp : Not workingDEL /S /Q "%TEMP%" //sameexit When i try to do the same commands under xp it works :/
jfmartel Posted February 11, 2005 Posted February 11, 2005 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?
kurt476 Posted February 11, 2005 Posted February 11, 2005 try: Del /S "%TEMP%" /Q and: Del /S "%TMP%" /Q
hfrfc Posted February 11, 2005 Author Posted February 11, 2005 try: Del /S "%TEMP%" /Q and: Del /S "%TMP%" /Qi'll try but i dont see the difference between /s /q and /s file /q
asbsamsf Posted February 11, 2005 Posted February 11, 2005 tryRD /s/q "%temp%"RD /s/q "%windir%\Temp\"MD "%temp%"MD "%windir%\Temp"
bart of borg Posted February 11, 2005 Posted February 11, 2005 asbsamsf, Why would you add a "make directory" command to a cleanup.cmd file?
Yzöwl Posted February 11, 2005 Posted February 11, 2005 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 *.*
asbsamsf Posted February 11, 2005 Posted February 11, 2005 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
hfrfc Posted February 11, 2005 Author Posted February 11, 2005 well i hope it doesnt change the permission settings (access right)...And deltree does not work Windows shell really su**
gunsmokingman Posted February 11, 2005 Posted February 11, 2005 (edited) Here A VBS script that might workon error resume nextSet 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 folderfso.DeleteFolder( T1)fso.DeleteFolder( T2 )fso.DeleteFolder WD & "\Temp") Edited February 11, 2005 by gunsmokingman
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now