We investigate gauge-invariant cosmological perturbations in a spatially flat Friedmann-Robertson-Walker universe with scalar fields. It is well known that the evolution equation for the gauge-invariant quantities has exact solutions in the long-wavelength limit. We find that these gauge-invariant solutions can be obtained by differentiating the background solution with respect to parameters contained in the background system. This method is very useful when we analyse the long-wavelength behaviour of cosmological perturbations with multiple scalar fields.