We study a string inspired cosmological with variable potential through the Lagrangian invariance method in order to determine the form of the potential. We have studied four cases by combining the different fields, that is, the dilaton [Formula: see text] the potential [Formula: see text] the [Formula: see text]-field and the matter field (a perfect fluid). In all the studied cases, we found that the potential can only take two possible forms: [Formula: see text] and [Formula: see text] where [Formula: see text] and [Formula: see text] are numerical constants. We conclude that when we take into account the Kalb–Ramond field, i.e. the [Formula: see text]-field, then it is only possible to get a constant potential, [Formula: see text] Nevertheless, if this field is not considered, then we get two possible solutions for the potential: [Formula: see text] and [Formula: see text] In all the cases, if the potential is constant, [Formula: see text] then we get a de Sitter like solution for the scale factor of the metric, [Formula: see text], which verifies the [Formula: see text]-duality property, while if the potential varies, then we get a power-law solution for the scale factor, [Formula: see text] [Formula: see text]