Escape both % and $ in the command line

Fixes issue #1884