- ::1.批处理运行窗口显示1~100这100个数字
- @echo off
- (
- for /l %%a in (1 1 100) do (
- echo;%%a ))
- pause
复制代码
- ::2.批处理运行窗口显示1、3、5...99这50个数字:
- @echo off
- (
- for /l %%a in (1 2 100) do (
- echo;%%a ))
- pause
复制代码
- ::3、将 bbs bathome.net (在同一行)分成三行显示在批处理运行窗口:
- @echo off
- (
- for /f "delims=" %%a in ("bbs bathome.net") do (
- echo;%%a ))
- pause
-
- @echo off
- ( for /f "tokens=1,2,3" %%a in ("bbs bathome.net") do (
- echo;%%a
- echo;%%b
- echo;%%c ))
- pause
复制代码
- ::4.①将f:\test.txt内容全部显示在批处理窗口;
- ::4.②只显示 2 5 8显示在批处理窗口(分三行显示,每字一行)
-
- @echo off
-
- (
-
-
- for /f "delims=" %%a in (f:\text.txt) do (
-
-
- echo;%%a
-
-
-
- )
- )
-
- pause
-
-
- @echo off
- (
-
- for /f "tokens=2" %%a in (f:\text.txt) do (
-
- echo;%%a
-
- )
- )
- pause
复制代码
[ 本帖最后由 johnson3333 于 2009-6-26 17:28 编辑 ] |