[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
@echo off
echo.
echo start..............
for /l %%i in (1,1,100) do echo %%i
echo.
pause
for /l %%i in (1,2,100) do echo %%i
echo.
pause
for %%i in (bbs bathome.net) do echo %%i
echo.
pause
echo "1 2 3">test.txt
echo "4 5 6">>test.txt
echo "7 8 9">>test.txt
echo finished!
pause

TOP

我的答案,请指教:
Title1.
  1. @echo off
  2. for /l %%a in (1 1 100) do echo/&echo %%a
  3. pause>nul
复制代码



Title2.
  1. @echo off
  2. for /l %%a in (1 2 100) do echo/&echo %%a
  3. pause>nul
复制代码



Title3.
  1. @echo off
  2. echo 处理前:bbs bathome.net
  3. echo\&echo/&echo.
  4. echo 处理后:
  5. for /f "tokens=1,2* delims= " %%a in ("bbs bathome.net") do echo %%a&echo.%%b&echo.%%c
  6. pause>nul
复制代码



Title4.
  1. @echo off
  2. type test.txt
  3. echo.&echo\
  4. for /f "tokens=2 delims= " %%a in (test.txt) do echo %%a&echo.
  5. pause>nul
复制代码

TOP

第三题这样做,不可以吗?
\@echo off
for %%i in (bbs bathome.net) do echo %%i
pause

TOP

第一题:
  1. for /l %%i in (1,1,100) do @echo %%i
复制代码
第二题:
  1. for /l %%i in (1,2,100) do @echo %%i
复制代码
第三题:
  1. @echo off
  2. set var=bbs bathome.net
  3. for /f "tokens=1-3 delims= " %%i in ("%var%") do (
  4. echo %%i
  5. echo %%j
  6. echo %%k
  7. )
复制代码
第四题:
1,
  1. for /f "delims=" %%i in (test.txt) do @echo %%i
复制代码
2,
  1. for /f "tokens=2" %%i in (test.txt) do @echo %%i
复制代码

TOP

1 for /l %%i in (1,1,100) do echo %%i
2 for /l %%i in (1,2,99) do echo %%i
3 for /f "tokens=1-3" %%i in ("bbs bathome.net") do (
echo %%i
echo %%j
echo %%k
)
4 ①for /f "delims=" %%a in (test.txt) do echo %%a  可以保证原格式。。。
   ②for /f "tokens=2" %%a in (test.txt) do echo %%a

[ 本帖最后由 claude55 于 2008-10-31 00:15 编辑 ]

TOP

for /l %%a in (1 1 100) do @echo %%a
for /l %%a in (1 2 99) do @echo %%a
for %%a in (bbs bathome.net) do @echo %%a
for /f "tokens=1,2,3" %%a in (test.txt) do @echo %%a %%b %%c
for /f "tokens=2" %%a in (test.txt) do @echo %%a

TOP

第4题答案

(1)。
@echo off
for /f "tokens=1-2*"  %%a in (f:/test.txt) do echo %%a %%b %%c
pause

(2)。

@echo  off
for /f   "tokens=2" %%a in (f:/test.txt) do echo  %%a  
pause

TOP

我是新手啊
试试看
1、批处理运行窗口显示1~100 这100 个数字;
@echo off
for /l %%i in (1 1 100) do echo %%i
pause>nul
2、批处理运行窗口显示 1、3、5.....99这50个数字;
@echo off
for /l %%i in (1 2 100) do echo %%i
pause>nul
3、将 bbs bathome.net (在同一行)分成三行显示在批处理运行窗口:
@echo off
for /f "tokens=1,2,3 delims= " %%a in ("bbs bathome.net") do (
echo %%a
echo %%b
echo %%c
)
pause>nul
4、先将以下内容保存到F:\test.txt

我是新手,那两题都不会做啊
砂石下的泉水,掘得越深,泉水会越清吗?

TOP

新手,看不明白,还得多学啊

TOP

  1. @echo off
  2. for /l %%i in (1 1 100) do echo %%i
  3. pause>nul
  4. for /l %%i in (1 2 99) do echo %%i
  5. pause>nul
  6. for /f "tokens=1,2,3" %%i in ("bbs bathome.net") do (
  7. echo %%i
  8. echo %%j
  9. echo %%k
  10. )
  11. pause>nul
  12. type 2.txt
  13. echo.
  14. for /f "tokens=2" %%i in (2.txt) do echo %%i
  15. pause>nul
复制代码

TOP

  1. @echo off
  2. for %%i in (bbs bathome.net) do echo %%i
  3. pause
复制代码
不管黑猫白猫,会捉老鼠的猫就是好猫!

TOP

@echo off
for /l %%i in (1 3 99) do echo %%i
pause
不管黑猫白猫,会捉老鼠的猫就是好猫!

TOP

@echo off
for /l %%i in (1 1 100) do echo %%i
pause
不管黑猫白猫,会捉老鼠的猫就是好猫!

TOP

第一个:
@echo off
for /l  %%i in (1,1,100) do echo %%i
set i=
pause
第二个:
@echo off
for /l  %%i in (1,2,99) do echo %%i
set i=
pause
第三个:
@echo off
for /f  "tokens=1-3  delims= " %%i in ("bbs bathome.net") do (
         echo %%i
         echo %%j
         echo %%k
)
set i=
set j=
set k=
pause
第四个:
@echo off
type test.txt
for /f "tokens=1-3 delims= " %%i in (test.txt) do echo %%j
pause
-----------------------------------------------------------------------------------------------
编辑一下,我将echo<变量>都按照echo %%val% 的格式写了(也没有错),应该是echo %%val,请高人解释一下为什么出了for就要用echo %val%格式,不太明白,谢谢~

[ 本帖最后由 batbird 于 2008-9-11 17:22 编辑 ]

TOP

  1. @echo off
  2. for /l %%i in (1,1,100) do echo %%i
  3. pause>null
  4. for /l %%j in (1,2,99) do echo %%j
  5. pause>nul
  6. echo bbs bathome.net
  7. set name=bbs bathome.net
  8. echo %name%
  9. echo 分三行显示:
  10. for /f "tokens=1 " %%a in ("%name%") do echo %%a
  11. for /f "tokens=2 " %%b in ("%name%") do echo %%b
  12. for /f "tokens=3 " %%c in ("%name%") do echo %%c
  13. for /f "tokens=1,2,3" %%a in ("%name%") do echo %%a %%b %%c
  14. pause>nul
  15. type first.txt
  16. echo 只显示 2 5 8显示在批处理窗口(分三行显示,每字一行)
  17. for /f "tokens=2 " %%a in (first.txt) do echo %%a
  18. for /f "tokens=5 " %%b in (first.txt) do echo %%b
  19. for /f "tokens=8 " %%c in (first.txt) do echo %%c
  20. pause>nul
复制代码

TOP

返回列表