HP Pavilion laptop’s battery would work, if you do these steps.
Go to Device Manager > select Batteries > Uninstall Microsoft ACPI-Compliant Control Method Battery.
Then the battery of my laptop should be removed.
Then wait for a minute before replacing it.
Then scan the laptop for hardware changes.
Check whether the laptop is charging.