Method for operating a washing machine or a washer-dryer having an outer tub, a drum arranged in the outer tub for receiving items of laundry and to which treatment fluid is applied, at least one spectrometer (21, 37), comprising an evaluation unit, at least one radiation source and at least one radiation detector, a control facility, a display apparatus and a dosing unit for dosing treatment agent, comprising at least one treatment agent container (12, 13, 14), wherein the treatment agent contains at least one treatment agent component and the method comprises the following step: measuring the treatment fluid with the at least one spectrometer (21, 37), by radiation being emitted by the at least one radiation source in at least one wavelength range of λ 1 to λ 2 in at least one time interval Δt, so that at least one part of the treatment fluid is applied therewith and the at least one radiation detector registers the radiation transmitted and/or reflected by the treatment fluid as a measuring signal; characterised in that the method comprises the steps: measuring the dry or damp items of laundry in the drum with the at least one spectrometer (21, 37), by radiation being emitted by the at least one radiation source in at least one wavelength range of λ 1 to λ 2 in at least one time interval Δt, so that the items of laundry are applied therewith, and the at least one radiation detector registers the radiation reflected and/or transmitted by the items of laundry as a measuring signal; wherein in step and λ 1 is in the ultraviolet range and λ 2 is in the infrared range and in the at least one wavelength range of λ 1 to λ 2 a compound, to be examined, of the items of laundry or the treatment fluid is excited over a wide band or in a number of wavelength ranges discrete bands of the compounds to be examined are excited over a narrow band, and wherein the compound to be examined is the type of contamination, the quantity of a contamination, the type of textile of the items of laundry or a treatment agent component, (b) transmitting the measuring signals obtained in step and to the evaluation unit and evaluating the measuring signals with an evaluation routine stored in the evaluation unit, with which the measuring signals are converted into a spectrum, qualitative and/or quantitative information about the respective compound is obtained on the basis of the position and development of specific bands in the respective spectrum, and is evaluated in respect of a recommended setting for at least one treatment parameter B p; and (c) transferring the measuring signals evaluated in step (b) to the control facility and outputting the recommended setting for the at least one treatment parameter B p to a user by way of the display apparatus and/or executing a treatment program with the recommended setting for the at least one treatment parameter B p; wherein the steps and/or to (c) are carried out once or repeatedly. measuring the treatment fluid with the at least one spectrometer (21, 37), by radiation being emitted by the at least one radiation source in at least one wavelength range of λ 1 to λ 2 in at least one time interval Δt, so that at least one part of the treatment fluid is applied therewith and the at least one radiation detector registers the radiation transmitted and/or reflected by the treatment fluid as a measuring signal; characterised in that the method comprises the steps: measuring the dry or damp items of laundry in the drum with the at least one spectrometer (21, 37), by radiation being emitted by the at least one radiation source in at least one wavelength range of λ 1 to λ 2 in at least one time interval Δt, so that the items of laundry are applied therewith, and the at least one radiation detector registers the radiation reflected and/or transmitted by the items of laundry as a measuring signal; wherein in step and λ 1 is in the ultraviolet range and λ 2 is in the infrared range and in the at least one wavelength range of λ 1 to λ 2 a compound, to be examined, of the items of laundry or the treatment fluid is excited over a wide band or in a number of wavelength ranges discrete bands of the compounds to be examined are excited over a narrow band, and wherein the compound to be examined is the type of contamination, the quantity of a contamination, the type of textile of the items of laundry or a treatment agent component, (b) transmitting the measuring signals obtained in step and to the evaluation unit and evaluating the measuring signals with an evaluation routine stored in the evaluation unit, with which the measuring signals are converted into a spectrum, qualitative and/or quantitative information about the respective compound is obtained on the basis of the position and development of specific bands in the respective spectrum, and is evaluated in respect of a recommended setting for at least one treatment parameter B p; and (c) transferring the measuring signals evaluated in step (b) to the control facility and outputting the recommended setting for the at least one treatment parameter B p to a user by way of the display apparatus and/or executing a treatment program with the recommended setting for the at least one treatment parameter B p; wherein the steps and/or to (c) are carried out once or repeatedly.