In your particular example, it seems the problem is with the “$”. That is used to indicate a variable reference, and yet you don’t have a name.
You can escape it (and most special characters) with "" in front, e.g.
/user set admin password="!@test#\$"
In more general terms, you can escape ANY character by substituting it with "", followed by two hex digits, to indicate its ASCII value (or if you’re escaping Unicode, this would be escaping one byte from the character), so e.g.