
CODE: [Copy to clipboard]如何替换成"真好呀!!!"
CODE: [Copy to clipboard][ Last edited by HAT on 2008-12-26 at 10:45 ]setlocal ENABLEDELAYEDEXPANSION
for /f %%a in (1.txt) do (
set str=%%a
set str=!str:^!=@!
echo !str!
pause)
set /?
Environment variable substitution has been enhanced as follows:
%PATH:str1=str2%
would expand the PATH environment variable, substituting each occurrence
of "str1" in the expanded result with "str2". "str2" can be the empty
string to effectively delete all occurrences of "str1" from the expanded
output. "str1" can begin with an asterisk, in which case it will match
everything from the beginning of the expanded output to the first
occurrence of the remaining portion of str1.
| Quote: | |
|








CODE: [Copy to clipboard][ Last edited by moniuming on 2008-12-25 at 23:33 ]@echo off
for /f "delims=" %%a in ('more +7^<%~fs0') do (
set "str=%%a"
call set "str=%%str:!=@%%"
call echo.%%str%%
)
pause>nul&goto :eof
"真好呀!!!"

| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |