Two-dimensional Raman and hybrid terahertz-Raman spectroscopic techniques provide invaluable insight into molecular structures and dynamics of condensed-phase systems. However, corroborating experimental results with theory is difficult due to the high computational cost of incorporating quantum-mechanical effects in the simulations. Here, we present the equilibrium–nonequilibrium ring-polymer molecular dynamics (RPMD), a practical computational method that can account for nuclear quantum effects on the two-time response function of nonlinear optical spectroscopy. Unlike a recently developed approach based on the double Kubo transformed (DKT) correlation function, our method is exact in the classical limit, where it reduces to the established equilibrium-nonequilibrium classical molecular dynamics method. Using benchmark model calculations, we demonstrate the advantages of the equilibrium–nonequilibrium RPMD over classical and DKT-based approaches. Importantly, its derivation, which is based on the nonequilibrium RPMD, obviates the need for identifying an appropriate Kubo transformed correlation function and paves the way for applying real-time path-integral techniques to multidimensional spectroscopy.