返回列表 发帖
@echo off
setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%i in (c:\Users\KINGBOOK\Desktop\a.txt) do (
set /a n+=1
if !n! equ 1 echo 一┃%%i
if !n! equ 2 echo 二┃%%i
if !n! equ 3 echo 三┃%%i
if !n! equ 4 echo 四┃%%i
if !n! equ 5 echo 五┃%%i
)
pauseCOPY

TOP

还好吧
@echo off
setlocal enabledelayedexpansion
set "aa=一|二|三|四|五|"
for /f "tokens=*" %%a in (F:\1.txt) do (set /a js+=1&set bb=%%a&call :loop)
pause>nul&exit
:loop
if %js%==1 echo !aa:~0,2!%bb%&goto :eof
if %js%==2 echo !aa:~2,2!%bb%&goto :eof
if %js%==3 echo !aa:~4,2!%bb%&goto :eof
if %js%==4 echo !aa:~6,2!%bb%&goto :eof
if %js%==5 echo !aa:~8,2!%bb%&goto :eofCOPY

TOP

每一题代码的写法都有所不同,建议往别的方向考虑一下。
我们仅仅针对这道题这说,排除变量名的不同,代码相似度,通过使用不同的命令组合,
解答这题的方案大概也有5到6种。
@echo off&setlocal enabledelayedexpansion
set "l=一二三四五"
for /f %%i in (a.txt) do (
   call set/p=%%l:~!n!,1%%<nul&echo,^|%%i
       set/a n+=1
)
pause>nul&exitCOPY
这样。应该很不错。
踏实一些点.不要着急.你想要的时间都会给你.2

TOP

@echo off&setlocal enabledelayedexpansion
set n1=一
set n2=二
set n3=三
set n4=四
set n5=五
for /f "delims=" %%a in (1.txt) do (
    set /a t+=1
    call,set /p=%%n!t!%%<nul
echo;^|%%a
)
pauseCOPY

TOP

回复 49# 尘丶
@echo off&setlocal enabledelayedexpansion
(for %%a in (一 二 三 四 五) do set /p %%a=%%a^|&echo;!%%a!)<a.txt
pauseCOPY
1

评分人数

    • 尘丶: 还能这样用,这招太给力了技术 + 1

TOP

回复 1# wxcute
@echo off
setlocal enabledelayedexpansion
set line=0
set head=一二三四五
for /f %%I in (a.txt) do (
    echo !head:~,1!^|%%I
    set head=!head:~1!
)COPY

TOP

贴个用数组的,可显示1~99行
@echo off
setlocal enabledelayedexpansion
set hanghao=一 二 三 四 五 六 七 八 九 十
echo %hanghao%
set index=1
for %%a in (%hanghao%) do (
set indexarray[!index!]=%%a
call echo %%indexarray[!index!]%%
set /a index+=1
)
set no=1
for /f "delims=" %%a in (a1.txt) do (
if !no! leq 10 (
call echo %%indexarray[!no!]%%|%%a
) else if !no! lss 100 (
set /a shiw=!no!/10
set /a gew=!no!%%10
call echo %%indexarray[!shiw!]%%!indexarray[10]!%%indexarray[!gew!]%%|%%a
)
set /a no+=1
)COPY

TOP

新手报到,请多多关照

TOP

@echo off
setlocal enabledelayedexpansion
set str=一二三四五
for /f %%i in ( a.txt ) do (
echo !str:~0,1!^|%%i
set str=!str:~1!
)
pauseCOPY

TOP

@echo off
set arr=一二三四五
set /a index=0
setlocal enabledelayedexpansion
for /f %%i in (a.txt) do (
        call echo %%arr:~!index!,1%%┃%%i
        set /a index+= 1
)
pause

TOP

返回列表