Computing.Net > Forums > Programming > please verify for me this

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

please verify for me this

Reply to Message Icon

Name: brockey01
Date: February 5, 2009 at 18:49:00 Pacific
OS: Windows XP
CPU/Ram: 1024
Product: Hewlett-packard / Sd2100
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: brockey01
Date: February 6, 2009 at 08:54:31 Pacific
Reply:

help please. not sure what the problem is.


0

Response Number 2
Name: brockey01
Date: February 6, 2009 at 16:10:50 Pacific
Reply:

any idea guys i think everything is right but not sure


0

Response Number 3
Name: Judago
Date: February 6, 2009 at 16:38:18 Pacific
Reply:

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


0

Response Number 4
Name: brockey01
Date: February 6, 2009 at 16:43:16 Pacific
Reply:

ok then why when i create a EXE it closes on me when it shouldnt?


0

Response Number 5
Name: Judago
Date: February 6, 2009 at 19:20:44 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: February 6, 2009 at 19:57:41 Pacific
Reply:

I have yet to see a bat compiler that works.


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

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: please verify for me this

Please review for me (batch file) www.computing.net/answers/programming/please-review-for-me-batch-file/14716.html

make simple program for me? www.computing.net/answers/programming/make-simple-program-for-me/690.html

Can XCOPY do this for me? www.computing.net/answers/programming/can-xcopy-do-this-for-me/17231.html