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 ϕ, the potential V(ϕ), the H-field and the matter field (a perfect fluid). In all the studied cases, we found that the potential can only take two possible forms: V=V0 and V=V0emϕ, where V0 and m are numerical constants. We conclude that when we take into account the Kalb–Ramond field, i.e. the H-field, then it is only possible to get a constant potential, V=V0. Nevertheless, if this field is not considered, then we get two possible solutions for the potential: V=V0 and V=V0emϕ. In all the cases, if the potential is constant, V=V0, then we get a de Sitter like solution for the scale factor of the metric, a(t), which verifies the T-duality property, while if the potential varies, then we get a power-law solution for the scale factor, a=ta1,a1∈ℝ.