Search code examples
escapingbatch-processing

escape all characters in batch variable


Hey everyone so I have the following batch variable %~4 which is a users username. Currently, I am having a problem because I had a user signup with the username Scott123! the ! is not read correctly. I tried escaping it like this "%~4" and that works on most characters but not the ! character. Has anyone come up with a solution for this?


Solution

  • One of the ways I got it to work was commenting out SETLOCAL ENABLEDELAYEDEXPANSION and putting "" around the variable.