I shall in all my best obey you, madam.
Hamlet agrees to obey the King and Queen (at least, he agrees to obey HER) in the chain of command. From now on he is forbidden from grieving about his father and cannot return to university. For the time being, he submits to his uncle’s wishes, as a favor to his mother.
The line could also be read as a bit of a dig against Claudius: “I shall in all my best obey you [read "not him”], madam."
To help improve the meaning of these lyrics, visit "Hamlet Act 1 Scene 2" by William Shakespeare and leave a comment on the lyrics box