Creating a batch version of a script that renames Vertex Groups
Using API methods
In main in the following, saves the current mode, sets mode  to 'OBJECT', iterates through all mesh objects in context.selected_objects either uses existing vertex grouped named after object, or creates a new one and assigns all vertices to it with a weight of 1. Then returns context.object back to its original mode.
import bpy
def main(context):
    mode = context.object.mode
    bpy.ops.object.mode_set(mode='OBJECT')
    meshobs = [o for o in context.selected_objects
            if o.type == 'MESH']
    for mo in meshobs:
        me = mo.data
        vg = (mo.vertex_groups.get(mo.name)
                or mo.vertex_groups.new(mo.name))
        # add all verts
        vg.add(range(len(me.vertices)), 1, 'REPLACE')
    bpy.ops.object.mode_set(mode=mode)


main(bpy.context)