首先指出直接写入是不可能的,但可以进行改写:
问题一:- @echo off&setlocal enabledelayedexpansion
- set t=%date:~,-4%&set t=!t:-=!
- for /f "delims=" %%i in ('type 1.ini') do (
- set /a n+=1
- if !n! equ 1 (
- echo %%i>1.ini
- ) else (
- if !n! equ 20 (
- set "str=%%i"&set m=0&call :lp
- echo %str%>>1.ini
- ) else (
- echo %%i>>1.ini
- )))
- echo 搞定&pause>nul&goto :eof
- :lp
- set "a=%str:~,1%"&set "var=%var%!a!"
- if "%a%" gtr "z" set / a m+=1
- if %m% equ 10 set "str=%var%%t%%str%"&goto :eof
- set "str=%str:~1%"&goto lp
复制代码 问题二:
只要把以上代码稍做修改可以了- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('type 1.ini') do (
- set /a n+=1
- if !n! equ 1 (
- echo %%i>1.ini
- ) else (
- if !n! equ 7 (
- set "str=%%i"&set m=0&call :lp
- echo %var%>>1.ini
- ) else (
- echo %%i>>1.ini
- )))
- echo 搞定&pause>nul&goto :eof
- :lp
- set "a=%str:~,1%"&set "var=%var%!a!"
- if "%a%" leq "z" set / a m+=1
- if %m% equ 7 goto :eof
- set "str=%str:~1%"&goto lp
复制代码
[ 本帖最后由 batman 于 2008-7-24 16:15 编辑 ] |