Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello all and thank you for reading my post. I have a question about a batch file. I have a batch file that will uninstall certain programs by selection. I work on people's computers and most of my work is uninstalling spyware. I install tools like ad-aware, spybot, spysweeper, etc. When I’m done working on their computers I run my batch file to uninstall my tools. My problem is I would like the batch file to automatically see if the customer already had ad-aware or spybot installed by looking at the date modified and run the uninstaller if the program was installed less than a week ago. Here is an example of my batch file below:
@ECHO OFF
CLS
:LOOP
ECHO A. Uninstall Ad-aware
ECHO B. Uninstall SpyBot
ECHO C. Uninstall Spysweeper
ECHO D. Uninstall MS AnitSpyware
ECHO E. Uninstall GIANT
ECHO F. Uninstall Crap Cleaner
ECHO G. Uninstall Avast
ECHO Q. Quit
ECHO.
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET Choice=
SET /P Choice=Type the letter and press Enter:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='A' GOTO Ad-Aware
IF /I '%Choice%'=='B' GOTO SpyBot
IF /I '%Choice%'=='C' GOTO SpySweeper
IF /I '%Choice%'=='D' GOTO MSAnitSpy
IF /I '%Choice%'=='E' GOTO GIANT
IF /I '%Choice%'=='F' GOTO CCLEANER
IF /I '%Choice%'=='G' GOTO avast
IF /I '%Choice%'=='Q' GOTO End
ECHO "%Choice%" is not valid. Please try again.
ECHO.
GOTO again:Ad-Aware
C:
echo Uninstalling Ad-Aware...
if exist "c:\program files\lavasoft\ad-aware se personal\Ad-Aware.exe" goto filefound
echo.
echo Ad-Aware not installed
goto again
:filefound
CD "C:\Program Files\Lavasoft\Ad-Aware SE Personal"
UNWISE.EXE /S
CD "C:\PROGRAM FILES"
RD /S /Q LAVASOFT
echo Ad-Aware uninstalled
GOTO Again:Again
PAUSE
CLS
GOTO Loop
:End

I would like to have to batch file look to see when the program was installed ie: look and the date modified on the .exe file. If the program was installed less than a week ago, goto uninstall program. I guess my question is, what command do I need to use to do this?
Thank you M2 for the help,
Kyle

![]() |
![]() |
![]() |

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