Procedure to induce a persistent current in superconducting cylinders or rings