从邮件服务器上导出的内容如下,每行是用户的一个属性,我只需要取其中InternetAddress\FullName\mailfile三个属性,并把它的值输出到一个文本文件。
LocalAdmin:
AvailableForDirSync: 1
CheckPassword: 0
PasswordChangeInterval: 0
PasswordGracePeriod: 0
我所编辑的脚本如下:- set OW=
- set EM=
- set MF=
- setlocal enabledelayedexpansion
-
- for /F "eol=O tokens=1,2* delims=:" %%i in (d:\test\contact.txt) do (
- if %%i==InternetAddress ( %EM%=%%j )
- if %%i==FullName ( %OW%=%%j )
- if %%i==MailFile ( %MF%=%%j )
- if "!MF!" NEQ "" ( echo %OW%;%EM% >>storemail.txt|set %OW%=|set %EM%="" )
- )
复制代码 发现For语句根本不循环。 |