Rip your walls open and fix the plumbing (by adding either extra pipe to make water-hammer absorbers or small captive-air tanks for the same purpose).
If your house already has the pipe extentions, it might get better for a while if you just drain all the pipes, so the "cushions" (capped sections of pipe) get filled with air - works until it all dissolves back into the water supply, though some optimists claim this never happens.
You MIGHT be able to add the captive-air type without actually ripping the walls open. MIGHT. (called "water hammer arrestor" in link below. Really just a small captive air tank, I think.)
Depending how you are plumbed, you can also slightly open a faucet further up the line, if there is a faucet further up the line.
I searched for some site with further explanation, this one looks OK, though I'm sure there are many others:
The Natural Handyman's Water Hammer Page