标题: 这段代码哪里错了,怎么弄都会多出个1来?
[打印本页]
作者: hdshjffdd
时间: 2006-8-19 15:15
标题: 这段代码哪里错了,怎么弄都会多出个1来?
echo %1 | find /i "htm"
if not Errorlevel 1 goto 4
goto end
:4
type %1 >1.htm
goto end
:end
参数%1为2.htm,运行结果如下
type "2.htm" 1>1.htm
The system cannot find the file specified.
后面多了一个1
作者: hdshjffdd
时间: 2006-8-19 15:17
将type改成copy也是一样!
作者: bagpipe
时间: 2006-8-19 16:25
如果你是用TYPE显示文本内容从而保存显示的内容,这可能是你2.HTM文件里的内容所导致的存储失败,如果你想显示 "2.HTM" 应该用DIR来显示,COPY是用来复制文件的,如果硬要用他显示文件内容,应该是copy 目标文件 con的形式,至于type "2.htm" 1>1.htm 为什么有1>1.htm是因为1>表示的是标准输出,2>表示的是错误输入 0< 表示标准输入
[
Last edited by bagpipe on 2006-8-19 at 16:26 ]