I am writing a script package to read from a file. The file contains lines such as token = value. I have code to analyze each line of the file, and it is stored in %% i. The following code tries to extract the value of the token:
Please note that this script uses a delayed extension as indicated in the comments.
for /f "tokens=1* delims==" %%a in ("%%i") do (
if "%%a"=="password" ( set password=%%b )
)
If the password value with a token contains "!" then "!" skipped, and only the rest of the line is stored in a variable password. Example if line:
password = Test!
then the password = Test variable. I tried changing the input file in various ways, and the script package reads everything except "!" . I used:
- password = "Test!"
- password = "Test ^!"
password = Test%!
password = Test%!
"!" . , "!" ?