This is what the guys from the military-industrial complex devised when they realised that the railgun just doesn't work too well. Basically a great many coils aligned in a tube-like manner, with insanely large capacitors to power them. There are also ingenious rotary generators that can be used instead of house-sized capacitors. A computer energises the coilgun's segments in a carefully programmed sequence to launch a metallic projectile out of the thing's muzzle.
Advantages: There's no wear on the barrel, and the process is fully under control from the moment the trigger is pressed up to the moment where the projectile leaves the muzzle.
Disadvantages: No impressive side-effects.
In theory, coilguns could be used to propel stuff into orbit. In the 1940s, a crackpot German engineer proposed that the German artillery (which has always liked megalomanic ideas) should build a rigidly-installed coilgun somewhere to put England under a continuous barrage of cheap, but mean high-explosive shells. The immense amounts of power needed would have required that this thing be installed next to a coal power plant, which, in turn, would have required to be installed next to a coal mine in France or Belgium or such. However, the plan was condemned to fail because the computers necessary to control a coilgun didn't exist at the time.