我有道批处理的程序编不出来了,请教一下:当输入a时,从指定位置或输入的参数位置拷贝一个文件;当输入b时,把c盘的txt文件,文件名及内容显示出来。我想了好久还是不能理解
[ Last edited by namejm on 2006-11-22 at 06:37 PM ]
[ Last edited by namejm on 2006-11-22 at 06:37 PM ]
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
| 评分人 | 分数 | 时间 |
|---|---|---|
| redtek | +1 | 2006-11-17 23:08 |
hxuan?表ー: 2006-11-22 11:35
- @echo off
- :in
- echo.
- set /p in="Input a or b ... (X=exit) > "
- if "%in%"=="" goto in
- if "%in%"=="x" goto end
- if "%in%"=="X" goto end
- if "%in%"=="a" goto a
- if "%in%"=="A" goto a
- if "%in%"=="b" goto b
- if "%in%"=="B" goto b
- goto in
- :a
- set /p infile="Input a file, path and name ... "
- if "%infile%"=="" goto a
- if exist "%infile%" (
- copy /y "%infile%" c:\
- ) else (
- echo "%infile%" is not exist!
- )
- goto in
- :b
- for /f "usebackq" %%f in (`"dir /b c:\*.txt"`) do (
- echo ----[%%f]----
- type "c:\%%f"
- )
- goto in
- :end
- exit 0