Go Back   Hardware Forums > Software Support Forums > General Software

Reply
 
LinkBack Thread Tools
Old 18-07-2008, 04:04 AM   #1 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

Exclamation .BAT program issue

In 2006, i created a very simple .BAT program to delete cookies, temporary files and so on....
I uploaded this 19kb .BAT file to DOWNLOAD.COM and got a 4 out of 5 from CNET and the same from a user!
Good news no? NOT REALLY. I got 2 users saying it deleted they're documents and all sorts of things!
Of course, they gave me a 1 out of 5 and lowered my score. It works fine on my pc though...

The questions is, i need someone who understands Command Prompt language and help me fix this error. Why does it delete absolutely everything on ones computer but work fine on another? Here's a sample of code from where the error seems to occur (Removing Junk Files)

Code:
ECHO                               Removing Junk Files

ECHO.

PING 127.0.0.1 /n 2 /w 1000 > NUL

TASKKILL /F /IM wdfmgr.exe

CD\
CD %ALLUSERSPROFILE%\Application Data\Microsoft\Dr Watson\
IF NOT EXIST "%ALLUSERSPROFILE%\Application Data\Microsoft\Dr Watson\" GOTO CD\
RD "." /S /Q

:CD\
CD %ALLUSERSPROFILE%\Application Data\Microsoft\Media Index\
IF NOT EXIST "%ALLUSERSPROFILE%\Application Data\Microsoft\Media Index\" GOTO CD\
DEL wmplibrary_v_0_12.db /Q

:CD\
CD %ALLUSERSPROFILE%\Application Data\Microsoft\MSDAIPP\Offline\
IF NOT EXIST "%ALLUSERSPROFILE%\Application Data\Microsoft\MSDAIPP\Offline\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\
IF NOT EXIST "%SYSTEMROOT%\schedlgu.txt" GOTO CD\
DEL schedlgu.txt /Q

:CD\
CD %SYSTEMROOT%\Debug\
IF NOT EXIST "%SYSTEMROOT%\Debug\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\Downloaded Installations\
IF NOT EXIST "%SYSTEMROOT%\Downloaded Installations\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\Downloaded Program Files\
IF NOT EXIST "%SYSTEMROOT%\Downloaded Program Files\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\Minidump\
IF NOT EXIST "%SYSTEMROOT%\Minidump\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\msdownld.tmp\
IF NOT EXIST "%SYSTEMROOT%\msdownld.tmp\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\PCHEALTH\HELPCTR\Config\Cache\
IF NOT EXIST "%SYSTEMROOT%\PCHEALTH\HELPCTR\Config\Cache\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\PCHEALTH\HELPCTR\Logs\
IF NOT EXIST "%SYSTEMROOT%\PCHEALTH\HELPCTR\Logs\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\PCHEALTH\HELPCTR\OfflineCache\
IF NOT EXIST "%SYSTEMROOT%\PCHEALTH\HELPCTR\OfflineCache\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\PCHEALTH\HELPCTR\Temp\
IF NOT EXIST "%SYSTEMROOT%\PCHEALTH\HELPCTR\Temp\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\Prefetch\
IF NOT EXIST "%SYSTEMROOT%\Prefetch\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\Cache\
IF NOT EXIST "%SYSTEMROOT%\system32\Cache\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\config\systemprofile\Cookies\
IF NOT EXIST "%SYSTEMROOT%\system32\config\systemprofile\Cookies\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\config\systemprofile\Local Settings\History\
IF NOT EXIST "%SYSTEMROOT%\system32\config\systemprofile\Local Settings\History\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\config\systemprofile\Local Settings\Temp\
IF NOT EXIST "%SYSTEMROOT%\system32\config\systemprofile\Local Settings\Temp\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\config\systemprofile\Local Settings\Temporary Internet Files\
IF NOT EXIST "%SYSTEMROOT%\system32\config\systemprofile\Local Settings\Temporary Internet Files\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\config\systemprofile\Recent\
IF NOT EXIST "%SYSTEMROOT%\system32\config\systemprofile\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\wbem\Logs\
IF NOT EXIST "%SYSTEMROOT%\system32\wbem\Logs\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\Temp\
IF NOT EXIST "%SYSTEMROOT%\Temp\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Microsoft\Office\Recent\
IF NOT EXIST "%USERPROFILE%\Application Data\Microsoft\Office\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\file\
IF NOT EXIST "%USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\file\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar\
IF NOT EXIST "%USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\tmp\
IF NOT EXIST "%USERPROFILE%\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\tmp\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Sun\Java\Deployment\cache\tmp\
IF NOT EXIST "%USERPROFILE%\Application Data\Sun\Java\Deployment\cache\tmp\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Application Data\Sun\Java\Deployment\tmp\
IF NOT EXIST "%USERPROFILE%\Application Data\Sun\Java\Deployment\cache\tmp\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Cookies\
IF NOT EXIST "%USERPROFILE%\Cookies\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Local Settings\Application Data\
IF NOT EXIST "%USERPROFILE%\Local Settings\Application Data\IconCache.db" GOTO CD\
DEL IconCache.db /Q

:CD\
CD %USERPROFILE%\Local Settings\History\
IF NOT EXIST "%USERPROFILE%\Local Settings\History\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Local Settings\Temporary Internet Files\
IF NOT EXIST "%USERPROFILE%\Local Settings\Temporary Internet Files\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\Recent\
IF NOT EXIST "%USERPROFILE%\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD %USERPROFILE%\UserData\
IF NOT EXIST "%USERPROFILE%\UserData\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Default User\Cookies\
IF NOT EXIST "\DOCUME~1\Default User\Cookies\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Default User\Local Settings\History\
IF NOT EXIST "\DOCUME~1\Default User\Local Settings\History\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Default User\Local Settings\Temp\
IF NOT EXIST "\DOCUME~1\Default User\Local Settings\Temp\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Default User\Local Settings\Temporary Internet Files\
IF NOT EXIST "\DOCUME~1\Default User\Local Settings\Temporary Internet Files\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Default User\Recent\
IF NOT EXIST "\DOCUME~1\Default User\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Application Data\Microsoft\Office\Recent\
IF NOT EXIST "\DOCUME~1\Guest\Application Data\Microsoft\Office\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Cookies\
IF NOT EXIST "\DOCUME~1\Guest\Cookies\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Local Settings\Application Data\
IF NOT EXIST "\DOCUME~1\Guest\Local Settings\Application Data\IconCache.db" GOTO CD\
DEL IconCache.db /Q

:CD\
CD \DOCUME~1\Guest\Local Settings\History\History.IE5\
IF NOT EXIST "\DOCUME~1\Guest\Local Settings\History\History.IE5\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Local Settings\Temp\
IF NOT EXIST "\DOCUME~1\Guest\Local Settings\Temp\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Local Settings\Temporary Internet Files\Content.IE5\
IF NOT EXIST "\DOCUME~1\Guest\Local Settings\Temporary Internet Files\Content.IE5\" GOTO CD\
RD "." /S /Q

:CD\
CD \DOCUME~1\Guest\Recent\
IF NOT EXIST "\DOCUME~1\Guest\Recent\" GOTO CD\
RD "." /S /Q

:CD\
CD %SYSTEMROOT%\system32\wdfmgr.exe

CLS

__________________

  Reply With Quote
Whats this? diNovo Edge Bluetooth Wireless Keyboard
diNovo Edge Bluetooth Wireless Keyboard
Seller Price (inc. VAT) Delivery Total Price Availability Seller Rating
Laskys.com £115.00 Free £115.00 In Stock Rated: 3 out of 5 - Number of votes: 39
Dabs4work.com £104.57 Free £104.57 In Stock Rated: 0 out of 5 - Number of votes:
IT247.com £111.01 Free £111.01 In Stock Rated: 4 out of 5 - Number of votes: 38
Old 18-07-2008, 08:02 PM   #2 (permalink) Top
Big Geek
 
thomas234's Avatar
 
Join Date: Feb 2006
Age: 16 Male
Posts: 715
Times Helpful: 32
My Mood: Bored
Status: Offline

My Computer

I can't see anything wrong with it. I ran it on my computer after searching through the script and there doesn't appear to be anything missing.

All I can think of it that these people are:

1) Lying?
2) Looking in the Documents section on the start menu for their files, which is actually the recent documents.
__________________
Nikon D40 + Sigma 18-200 f/3.5-6.3

A handful of photos

  Reply With Quote
Old 19-07-2008, 04:41 PM   #3 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

thats exactly my point! The code works absolutely fine on mine but is freakin chaotic to others.
This actually DID happen to me ONCE, during the development of the script... it happened when i replaced the "del" commands with "rd" commands. So next to the "rd" commands are "." which means remove all files and folders in that directory. I wrote a faulty "rd" code and thats when it happened, but ive long fixed that problem and i still dont understand why it happens to others.

Maybe computers with .net? Or computers with some sort of CMD hotfix?
__________________

  Reply With Quote
Old 19-07-2008, 07:24 PM   #4 (permalink) Top
Big Geek
 
thomas234's Avatar
 
Join Date: Feb 2006
Age: 16 Male
Posts: 715
Times Helpful: 32
My Mood: Bored
Status: Offline

My Computer

Hmmmm I'm not really sure, I don't think it's .NET as I run 3.5 on both my PC and laptop, and both are updated with the latest Windows Updates (most of the time), so I can't imagine it's some sort of hotfix.

Maybe someone else has a suggestion?
__________________
Nikon D40 + Sigma 18-200 f/3.5-6.3

A handful of photos

  Reply With Quote
Old 20-07-2008, 02:02 AM   #5 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,230
Times Helpful: 400
My Mood: Mellow
Status: Offline

My Computer

I haven't really looked through all the script but there doesn't seem to be anything wrong with it. I have a lot of work though, so you'll understand if I dont run unknown scripts for the sake of testing.

It won't be .NET, since it's separate to the command line utilities. The only thing that could be causing a problem, though I'm not sure is environment variables. Perhaps things like systemroot are not set on some people's machines or are different. Should probably take a look into the effects of the script in those cases.
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Old 26-07-2008, 04:17 PM   #6 (permalink) Top
Paranoid Geeky Geek
 
donkey42's Avatar
 
Join Date: Mar 2006
Age: 34 Male
Posts: 5,667
Times Helpful: 303
My Mood: Paranoid
Status: Offline

My Computer

personally i'm unfamiliar with Vista, however, i do remember DOS, i'll go through your bat file command by command
Quote:
Originally Posted by scorps
@ECHO OFF
do not show the command currently being executed
Quote:
Originally Posted by scorps
PING 127.0.0.1 /n 2 /w 1000 > NUL
correction to replace the ping command
Code:
CALL WAIT 10
Quote:
Originally Posted by scorps
CD\
unnecessary
Quote:
Originally Posted by scorps
CD %ALLUSERSPROFILE%\Application Data\Microsoft\Dr Watson\
change working directory / folder
Quote:
Originally Posted by scorps
IF NOT EXIST "%ALLUSERSPROFILE%\Application Data\Microsoft\Dr Watson\" GOTO CD\
correction
Code:
if exist "%ALLUSERPROFILE%\Applic~1\Micros~1\Drwats~1" goto CD
Quote:
Originally Posted by scorps
RD "." /S /Q
delete everything in & below the working directory without prompt, correct

if you look at your script, you will see every section title is the same
Quote:
Originally Posted by scorps
Code:
:CD\
each section title should be different & i don't think they can contain special characters (\)

Last edited by donkey42; 26-07-2008 at 04:23 PM. Reason: fix
  Reply With Quote
Old 27-07-2008, 08:22 PM   #7 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

Thanks guys!
and i will definitely try that out donkey
__________________

  Reply With Quote
Old 27-07-2008, 08:49 PM   #8 (permalink) Top
Paranoid Geeky Geek
 
donkey42's Avatar
 
Join Date: Mar 2006
Age: 34 Male
Posts: 5,667
Times Helpful: 303
My Mood: Paranoid
Status: Offline

My Computer

i was wrong about
Quote:
Originally Posted by donkey
if exist "%ALLUSERPROFILE%\Applic~1\Micros~1\Drwats~1" goto CD
BTW: i made the alterations and attached it, just rename it from .TXT to .bat, i actually forgot i'd done it, till you posted
Attached Files
File Type: txt DTMP.TXT (6.4 KB, 5 views)
  Reply With Quote
Old 29-07-2008, 12:54 AM   #9 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

I'm taking your advice on this donkey and am undergoing some overhauling. I removed the CD\'s since they are redundant.

In addition im going to limit the RD commands. I didn't manage to use the "call wait 10" command i simply don't have that. I'll stick with the "ping" since its not a big deal.

I'll be done with it soon enough!

And which one of you fine lads would like to test it out? NOW NOW ONE AT A TIME!
__________________

  Reply With Quote
Old 29-07-2008, 09:56 AM   #10 (permalink) Top
Paranoid Geeky Geek
 
donkey42's Avatar
 
Join Date: Mar 2006
Age: 34 Male
Posts: 5,667
Times Helpful: 303
My Mood: Paranoid
Status: Offline

My Computer

i'd try it, but, i use Kubuntu (Linux) so it won't work for me, & if i did use it i'd be ignoring myself, because, i promised myself i'd never install XP ever again except into an networking disabled VM

Edit: i'd also recommend some kind of redundancy / error output possibly prompt for an output filename to return errors to

Last edited by donkey42; 29-07-2008 at 10:08 AM. Reason: edit
  Reply With Quote
Old 29-07-2008, 05:38 PM   #11 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

I appreciate the courage! That's funny, i promised myself never to install Linux again! Unless, i have the time and effort to learn it again. I've tried it twice and always gave up since i was very confused (ubuntu and mandriva). I'm sure I'll try it once more in the future....

But anyways yes a log would actually be a good idea. Now... TO WORK!
__________________

  Reply With Quote
Old 29-07-2008, 06:19 PM   #12 (permalink) Top
Paranoid Geeky Geek
 
donkey42's Avatar
 
Join Date: Mar 2006
Age: 34 Male
Posts: 5,667
Times Helpful: 303
My Mood: Paranoid
Status: Offline

My Computer

Quote:
Originally Posted by scorps
I appreciate the courage! That's funny, i promised myself never to install Linux again! Unless, i have the time and effort to learn it again. I've tried it twice and always gave up since i was very confused (ubuntu and mandriva). I'm sure I'll try it once more in the future....
well after the fiasco that was Win9x i moved to XP & i used it how M$ said it could be used & 1 clean install would only last about 2 - 3 months, i was obviously abusing it & thanks to HWF i decided to go with Kubuntu 6.06 Dapper Drake, i'm now on 8.04 Hardy Heron because i was sick of ringing MS to reactivate XP

Quote:
Originally Posted by scorps
But anyways yes a log would actually be a good idea. Now... TO WORK!
shall i start work on it ?
  Reply With Quote
Old 29-07-2008, 06:26 PM   #13 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

Yeah. my only problem with Microsoft is its Legal annoyances and its stupid errors.

Well, im working on shortening the code and removing the RD commands, but any LOG commands you know of would be appreciated
__________________

  Reply With Quote
Old 30-07-2008, 09:36 AM   #14 (permalink) Top
Paranoid Geeky Geek
 
donkey42's Avatar
 
Join Date: Mar 2006
Age: 34 Male
Posts: 5,667
Times Helpful: 303
My Mood: Paranoid
Status: Offline

My Computer

Quote:
Originally Posted by scorps
Well, im working on shortening the code and removing the RD commands, but any LOG commands you know of would be appreciated
well personally i did use and like DOS & i've edited the bat file to include an error output (not finished yet) plus i am unaware of how Vista would play with the DOS commands in the bat, i've attached my work so far but please remember it's not finished & batch files are like plumbing, it only work when it's finished
Attached Files
File Type: txt DTMP.TXT (9.6 KB, 4 views)
  Reply With Quote
Old 03-08-2008, 08:51 AM   #15 (permalink) Top
Binary Warrior
 
scorps65's Avatar
 
Join Date: Nov 2007
Age: 19 Male
Posts: 189
Times Helpful: 16
My Mood: Doh
Status: Offline

My Computer

I'm happy to say that i've succeeded after a few days to log the events of my .BAT file (thanks in huge part by donkey ).
What i've done so far since the beginning of this thread:
1 - removed the RD (remove directory) command and replaced it with less harmful DEL commands.
2 - included a few temp folders for vista users
3 - removed meaningless CD commands i had before
4 - included the ">" command to output information to a .log file

What i haven't done is added the SET commands like in donkey's attached DTMP.TXT because i didn't understand its purpose.
Most importantly though, the RD command was the real risk taker and is now replaced. I will consider the SET commands for another time.

Attached here is the new and improved .BAT file. Ladies and gents... i give you... CleanupManager!
Although i explained here that a lot has been done to avoid its backfire (deleting your document folders, etc...) please BACK UP YOUR DOCUMENTS FOLDER AND ANY OTHER FILES YOU DON'T WANT DELETED IF YOUR GOING TO USE THIS.
I'm leaving the U.S. tomorrow and won't be back until the 14th! I hope someone has the guts to run it
Till tomorrow folks
PEACE
Attached Files
File Type: zip CleanupManager.zip (3.0 KB, 4 views)
__________________

  Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On
Forum Jump