In this work, the possibility of creating a molecular switch based on the spiropyran (SP) molecule has been investigated. A class of molecules containing a nitro group in the benzopyran fragment was studied. In the indoline fragment NH2, NO2, H, and Cl were used in different positions as substituents. It has been shown that between the SP molecule and corresponding merocyanine (MC) molecule and an electrode material (Ag, Au, Pt, and Pd) it is possible to сreate a contact at the expense of a chemical bond. Such a cell will be stable in the absence of an external electric field. The SP molecule will turn into the MC molecule with the application of a uniform external field with a magnitude of E > 0.02 a.u. (a negative sign is on the indoline moiety). When the field E = 0.01 a.u. with another polarity is applied, the MC molecule relaxes into the SP molecule.