First download Weblossless
Open up photoshop – windows – actions – hamburger menu – load actions – choose weblossless file you just downloaded
Once it’s loaded, find it under the actions window and make sure everything is unchecked:
Then, click file – automate – batch
How to set up the Batch Process
Set: weblossless
Source: choose the folder you want to export
Destination: choose the folder where you want your files to put after exporting
Make sure to check “Override Action “Save As” Commands”
Example:

Click ok and hopefully it’ll work!