I'm writing a batch script to read from a file. The file contains lines such as token=value. I have code to parse each line of the file and it is stored in %%i. The following code tries to extract the value of token:

**Take note that this script is using delayed expansion, as mentioned in the comments.**

```
   for /f "tokens=1* delims==" %%a in ("%%i") do (  
      if "%%a"=="password" ( set password=%%b )  
   )

```

If value of token password contains "!", then the "!" is skipped and only rest of the string is stored in variable password. Example, if the line is:

password=Test!

then variable password=Test . I have tried to change the input file various ways and batch script reads everything except "!". I have used:

1. password="Test!"
2. password="Test^!"
3. password=Test%!

password=Test%!

and everything skips "!". Any idea how I can read a string with "!" into a variable?