This script below using Magento 1.5, maybe work for other version
the simple and quick way to change the password is to change the password in the database using mysql command line or using phpmyadmin.
to generate your new password, head to http://m4tt.io/tools/magento-admin-generator/
all you have todo is fill that form, the most important field is the PASSWORD, others is not important
when you filled the form you can copy the hashed password, thats the only string we need
in this case i create new password ‘admin123’ and the hashed string is
now, in database, open table ‘admin_user’ and replace the password in your current database to your new string. my quick way is using phpmyadmin and just edit the record you want to change
and this is how you can change the password
now go to your admin login and try the new password.