You are not logged in.

#1 08 Mar 2015 11:13

chinkitkit
Member
Registered: 16 Dec 2014
Posts: 14

Delete junks program... :)

Hopefully this program helpful to you.

Hopefully some expert here can help me improve with the integrity of this program.

Hopefully some expert here can show me in any way to make some useful program in the future.

Do you think this is helpful ? comments ?


==================================================================================
@echo off
echo.
echo. Deleting files in Local temp and local CrashDumps !
echo.
echo. Hit any key to continue deletion.....
pause>nul

pushd %LOCALAPPDATA%\Temp
del /Q *

pushd %LOCALAPPDATA%\CrashDumps
del /Q *

pushd %programfiles(x86)%\Google\CrashReports
del /Q *.dmp
pause
==================================================================================




==================================================================================
*Disclaimer: no hater will be entertained. Only positive criticism will be entertained. Thank you.
==================================================================================


Detour in life always surprise people.

Offline

#2 08 Mar 2015 14:15

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Delete junks program... :)

You code can delete files that are not intended, if the pushd fails or if there are spaces in the path - which will cause the pushd to fail.
The files in whichever folder is the current directory would be deleted.

Specifying the path is always safest - or use errorlevel tests with pushd

@echo off
pushd "c:\my folder" 2>nul && (del *.txt & pause & goto :eof)

The *.*? will suppress a prompt asking if you are sure that you wish to delete the files.
This can be done other ways in modern windows but the *.*? method works for older Windows too.

This is untested:

@echo off
echo.
echo. Deleting files in Local temp and local CrashDumps !
echo.
echo. Hit any key to continue deletion.....
pause>nul

del /Q "%LOCALAPPDATA%\Temp\*.*?"  "%LOCALAPPDATA%\CrashDumps\*.*?" "%programfiles(x86)%\Google\CrashReports\*.dmp"
pause

Offline

#3 09 Mar 2015 04:59

chinkitkit
Member
Registered: 16 Dec 2014
Posts: 14

Re: Delete junks program... :)

Hey Foxidrive, Thanks for your comments anyway... xD

i'm sure i'm gained something from you here. Thanks !

Keep in touch !

big_smile  big_smile  big_smile


Detour in life always surprise people.

Offline

Board footer

Powered by