Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String BATCH CMD-读取带有特殊字符的INI文件_String_Variables_Batch File_Cmd_Dos - Fatal编程技术网

String BATCH CMD-读取带有特殊字符的INI文件

String BATCH CMD-读取带有特殊字符的INI文件,string,variables,batch-file,cmd,dos,String,Variables,Batch File,Cmd,Dos,我正在读取一个config.ini文件,我想使用KEY作为变量名,VALUE作为VALUE Config.ini fbdestination=I:\WZPDA\workingfolder\stored emailreport=xxx@xxxx.xxx gmailudpw=USERNAME:PASSWORD 即时通讯使用: FOR /F "tokens=1,2 delims=^=" %%A IN (config.ini) DO (SET %%A=%%B) 一切正常,但我有一个复杂的密码问题,如

我正在读取一个config.ini文件,我想使用KEY作为变量名,VALUE作为VALUE

Config.ini

fbdestination=I:\WZPDA\workingfolder\stored
emailreport=xxx@xxxx.xxx
gmailudpw=USERNAME:PASSWORD
即时通讯使用:

FOR /F "tokens=1,2 delims=^=" %%A IN (config.ini) DO (SET %%A=%%B)
一切正常,但我有一个复杂的密码问题,如:

myusername:!myp4ssw0rd!
如果我尝试回显$gmailudpw$,我只有:

myusername:
有没有阅读的方法!myp4ssw0rd!作为字符串而不是变量

谢谢你

试着这样做:

@echo off
setlocal disabledelayedexpansion
FOR /F "tokens=*" %%A IN ('type "config.ini"') DO SET %%A
echo %fbdestination%
echo %emailreport%
echo %gmailudpw%

您无法从命令
类型中获得任何可见结果。仅通过命令
echo
。如果您不需要它,请将其移除。我已经删除了echo命令,因为我只需要变量,但我必须将cls放在“set%%A”之后,以隐藏整个ini内容。