HC-05 AT mode works - PSWD command doesn't

I was able to change the name of my HC-05 Bluetooth module in AT mode, using:

Serial.println("AT+NAME=NEWNAME");

HC-05 namely expects \r\n at the end.
Serial.write() doesn't seem to want to transmit these characters.

However, changing the PIN doesn't work.

Using Serial.read(), I wrote the input directly in the terminal with the CR LF option switched on. It didn't work. It did work by using quotation marks: AT+PSWD="9876".

I tried to insert the new findings in my automated program:

Serial.println("AT+PSWD=\"9876\"");

This returns ERROR(1D) or ERROR(0).

Does anyone have an idea why this particular command fails to work, whilst the other commands do work and with the remaining code unchanged?

hello Nils345 you need to see this thread:

About HC-05

The thread you linked is using Serial.read(), typing the AT commands in the terminal.

I have an issue sending the commands using Serial.println (or Serial.write), after having verified that the terminal method works using Serial.read(), meaning I am using the right commands.

This thread doesn't answer my question.

Solved.
I simply needed a small delay between the AT commands, so between NAME and PSWD.