The invention provides a square wave generation and multipath output device, a system and a method. The device comprises a power supply, a photoelectric encoder, a distribution signal board, an analogsignal board, a photoelectric module, and a signal change-over switch. The analog signal board and the photoelectric encoder are connected with the distribution signal board through the signal change-over switch, and the photoelectric module is connected with the distribution signal board; the device is connected with an external device through an optical fiber to avoid signal interference; the transmission distance of the same signal can be increased through optical fiber networking and port expansion of each device, the stability is good, and no interference exists; signal switching switch,the analog signal board outputs an analog square wave signal during parking, and the photoelectric encoder outputs an actual square wave signal during vehicle driving, thereby achieving the generation and multipath output of square wave signals in various states of a detection vehicle, improving the work efficiency of railway infrastructure detection, and providing a guarantee for the railway operation safety detection.