[英]BATCH CMD - Read INI file with specialcharacter
I'm reading a config.ini file and i want to use KEY as a Variable name with VALUE as VALUE. 我正在读取config.ini文件,我想使用KEY作为变量名称,VALUE为VALUE。
Config.ini 的Config.ini
fbdestination=I:\WZPDA\workingfolder\stored
emailreport=xxx@xxxx.xxx
gmailudpw=USERNAME:PASSWORD
Im using: 我正在使用:
FOR /F "tokens=1,2 delims=^=" %%A IN (config.ini) DO (SET %%A=%%B)
Everything works well, but I have a problem with a complex password like: 一切都运作良好,但我有一个复杂的密码问题,如:
myusername:!myp4ssw0rd!
Where if I try to ECHO $gmailudpw$ I only have : 如果我尝试ECHO $ gmailudpw $我只有:
myusername:
Is there a way to read !myp4ssw0rd! 有没有办法阅读!myp4ssw0rd! as a string and not as a variable ?
作为字符串而不是变量?
Thank you 谢谢
Try like this : 试试这样:
@echo off
setlocal disabledelayedexpansion
FOR /F "tokens=*" %%A IN ('type "config.ini"') DO SET %%A
echo %fbdestination%
echo %emailreport%
echo %gmailudpw%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.