This project has moved and is read-only. For the latest updates, please go here.

Escaping a password entered on a Windows command line

Topics: Technical Issues, Users Discussion
Jan 30 at 6:50 PM
When mounting a volume from a Windows command line, how do I escape a password containing special characters?

Many thanks,
David.
Jan 31 at 9:10 PM
If using in a command window, or run dialog, just enclosing the password in double quotes eg /p "$!&^%><\/'^" should work, no escaping needed! However, in batch files, some characters just don't seem to be permissible, and don't seem escapable (no idea why) eg % ' £ (there may be others). Are you having particular issues with specific characters?
Jan 31 at 10:29 PM
Edited Jan 31 at 10:53 PM
AdrianKIT,

Yes, at the very least I was having issues with " (double-quote). To demonstrate this, I created a volume with a password of a single double-quote, no PIM and no keyfile. Using the command line to attempt to mount this, I got four different responses depending on the password I used...
  • For ", "" and ^", the standard "Enter Password" dialogue was immediately displayed.
  • For ?", a VeraCrypt message was immediately displayed - "Error while parsing command line."
  • For a", the standard incorrect password sequence (i.e. "Please wait...", followed by "Operation failed..." and then the password dialogue).
  • Finally, \" succeeded!
This has been driving me crazy for the last few days (with a mixture of unwarranted optimism and sheer despair, I had even downloaded the VeraCrypt source).

Many thanks for your interest - trying to document this for you was enough to get me over the line!

I'm sure that there are other characters that'll need escaping - at the very least the backslash, but most problem children work fine. So, a volume whose password is __!"£$%^&*()<>?__ can be mounted from the command line using
!\"£$%^&()<>?
or from a batch file by using
!\"£$%%^&
()<>?
(Sorry for the messy format, ironically the backslash apparently needs to be escaped on this site!)

I'll check out the requirements for the backslash and report back.
Update
I tried a volume with a password of \". I've not been able to open this from the command line. My failures include
\"
\"
^\"
^\^\"
^\^\^"
\""

Regards,
David.