Visit the modpack's page (usually on CurseForge or Modrinth) download the server version ZIP.
Extract it to a clean folder.
Locate the run.bat and double-click it to generate necessary files.
Zip up all contents of the folder again.