I have a script to install a custom Windows Live Messenger after cleaning many data leftovers, eliminating related issues.
This script searches for occurrences of folders 'Contacts', 'Windows Live Contacts' and 'MSN Messenger' and deletes them, taking the 'Documents and Settings' as base folder. I could use %USERPROFILE% environment variable here, but how get a directory before that? usually leftovers are on many profiles.
Also, the way it is, it is searching inside the 'My documents' folder too, which should be an exception. How accomplish that since 'My documents' can have any name? Probably get that info from registry or using a tool written by some of you, but how exactly?
Please, if you have any suggestions to improve this script, let me know!
Best regards &
Code: Select all
@echo off
setlocal
pushd "%~dp0"
taskkill /f /im msnmsgr.exe /im wlcomm.exe
sleep 1
msizap.exe TW! {ED00D08A-3C5F-488D-93A0-A04F21F23956}
msizap.exe TW! {B5ED7AB0-3838-4389-8549-7C8E22DD48F4}
msizap.exe TW! {22B775E7-6C42-4FC5-8E10-9A5E3257BD94}
msizap.exe TW! {A1F66FC9-11EE-4F2F-98C9-16F8D1E69FB7}
if /i %processor_architecture% equ x86 (set wlp="%ProgramFiles%\Windows Live") else (set wlp="%SystemDrive%\Program files (x86)\Windows Live")
attrib -r -h -s %wlp% /d /s
rd /s /q %wlp%
set ds=C:\Documents and Settings
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Contacts"') do attrib -r -h -s "%%g" /d /s
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Contacts"') do rd "%%g" /s /q
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Windows Live Contacts"') do attrib -r -h -s "%%g" /d /s
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Windows Live Contacts"') do rd "%%g" /s /q
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Messenger"') do attrib -r -h -s "%%g" /d /s
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\Messenger"') do rd "%%g" /s /q
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\MSN Messenger"') do attrib -r -h -s "%%g" /d /s
for /f "tokens=*" %%g in ('dir /b /a /ad /s "%ds%\MSN Messenger"') do rd "%%g" /s /q
start /wait .\setup\crt.msi
start /wait .\setup\dw20shared.msi
start /wait .\setup\Contacts.msi
start /wait .\setup\SegoeFont.msi
start /wait .\setup\Messenger.msi
pause
popd
exit