First, you need to power off your Cisco switch.
Keep the Mode button pressed and turn on your device.
The mode button is available on the front panel of your Switch
Wait until the following messages on the console of your Switch.
Use the flash_init command to initialize the Flash filesystem of your Cisco Switch.
The following messages should be displayed. (or something similar)
List the content of the flash drive of your switch.
Rename the default configuration file config.text to config.text.old.
Use the boot command to start the Cisco Switch.
After finishing the boot process, enter the command-line privileged mode using the enable command.
Then copy all the configuration from the config.old file to the RAM memory of your switch.
Access the configuration mode, change the secret password of your switch, save your configuration and reboot the device.
You have finished the required configuration to recover the Password of a Cisco switch.