please verify for me this

Hewlett-packard / Sd2100
February 5, 2009 at 18:49:00
Specs: Windows XP, 1024
i have a batch that deletes vista and xp temp files. well im getting alot of process in use errors, how can i stop this. also please check my code and edit if you will please the temp locations because both vista and xp when converting to a exe both close but under batch dont.

xp:
del /f /q %windir%\Temp\*.*
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"


vista:
el /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q "%appdata%\Microsoft\Windows\cookies\*.*"
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%appdata%\Microsoft\Windows\Recent\*.*" >>
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /s /q %windir%\SoftwareDistribution\Download\*.*
rd /s /q "%userprofile%\Local Settings\Temp\" & md "%userprofile%\Local Settings\Temp\"
rd /s /q %windir%\Temp & md %windir%\Temp

Thanks Brock


See More: please verify for me this

Report •


#1
February 6, 2009 at 08:54:31
help please. not sure what the problem is.

Report •

#2
February 6, 2009 at 16:10:50
any idea guys i think everything is right but not sure

Report •

#3
February 6, 2009 at 16:38:18
If your getting process in use errors the problem is simple, something is still using the file and has it locked so you can't delete it.

I know your trying to reclaim disk space but some of these files are still serving their purpose.

You could suppress the error messages by redirecting stderr into nul. The problem would still exist but you would not have to see the messages.

2>nul del ......


Report •

Related Solutions

#4
February 6, 2009 at 16:43:16
ok then why when i create a EXE it closes on me when it shouldnt?

Report •

#5
February 6, 2009 at 19:20:44
If it works as a .bat or .cmd and doesn't work after being "compiled" to an exe there is a good reason. Many batch "compilers" simply compress the script with a stub of code that extracts batch file into the temp directory, like Bat To Exe converter from Fatih Kodak.

This means you script is deleting itself....

Here is a little test to "compile" into an exe so you can see what I mean.

echo The script is located at "%~f0"
pause
start notepad "%~f0"
pause


Report •

#6
February 6, 2009 at 19:57:41
I have yet to see a bat compiler that works.


=====================================
If at first you don't succeed, you're about average.

M2


Report •


Ask Question