In-situ laser absorption spectroscopy is commonly used for environmental monitoring and industrial process control, but fluctuations in field environmental conditions can affect measurement accuracy and stability. In the wavelength modulated spectroscopy (WMS) technique, the first harmonic or DC signal is often used for light intensity normalization, which to a certain extent weakens the influence of light intensity fluctuations caused by vibration, turbulence, etc. in the measurement optical path. However, the simultaneous extraction of different harmonic signals from the same absorbed spectrum using a lock-in amplifier requires at least two channels, and the inconsistency between the channels increases the complexity and uncertainty of the system. Therefore, a harmonic extraction method based on the short-time Fourier transform (STFT) is proposed, in which the discrete Fourier transform (DFT) is performed on the signal segment by segment by shifting the window function, and the DC component and the harmonic signals of each order can be extracted simultaneously according to the multiples of the modulation frequency. The effectiveness of this method is verified in the experimental system of CO2 in-situ measurement of laser absorption spectroscopy, and the results show that the relative errors of the harmonic signals extracted by the method in this paper are always kept within 0.6%, and the average time saved is about 34.62%.