Export Users with custom fields?
I know that this question has already been answered, but thought I'd point out the Views Data Export module for anyone looking for a contributed solution rather than a bespoke one. This module allows you to define Views that generate CSV files for export. We're using this with Drupal 7 for a client so that they can export all users and their associated custom fields. It's working well.