A versatile electron-impact time-of-flight mass spectrometer (EI-TOFMS) in a pulsed molecular beam has been constructed. The instrument contains a fast rise time, square pulse generator, biased at high voltage, which simplifies the implementation of EI-TOFMS. Power field effect transistors are used as the active switching element, which afford compact size and simplified circuit construction. The effect of the shape of the repelling pulse on the flight time and space focusing condition is estimated by numerical calculation. Preliminary test results are provided for pulsed molecular beams of ammonia and hydrogen iodide.