中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 【求助】怎么向文本文件加入空行
<   <<   [1] [2]  >>
作者:
标题: 【求助】怎么向文本文件加入空行 上一主题 | 下一主题
terrytong
中级用户





积分 240
发帖 115
注册 2008-3-10
状态 离线
『第 16 楼』:  

Originally posted by HAT at 2008-8-8 11:54: 用cd不要紧,在后面判断一下就行了。 否则,如楼上所说,早晚要后悔。
我判断过了,cd !dirc! 没有问题。 但是结果为: [PN] MP_PN=1602-276201-02 RMA_PN=NA SN_LENGTH=13 . [SFIS] Enable=0 SFIS_TIMEOUT = 25000 SFIS_IP=10.5.5.80 SFIS_Port=5010 FixtureID=T1_27 LINE=ZT4 . [Station] ChipId=none FA_Debug=disable SfCheckAutoFocus=disable . [GrayBox] R=255 G=0 B=0 Message="ERROR" . [ImageFile] Enable=0 ApplicationPath=fciv.exe CheckSumPath=imagefile_12MB.cks ConfigPath=param.ini BlockName=Options ItemName=UpLoadImagePath


2008-8-8 17:09
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
terrytong
中级用户





积分 240
发帖 115
注册 2008-3-10
状态 离线
『第 17 楼』:  

@echo off title set station ID for mPCIe mode con cols=100 lines=20 setlocal enabledelayedexpansion set /p IP=please input the IP number: set /p ID=please input the ID number: set one=1 set zero=0 cd\ d: for /r d:\zt4_mpcie %%a in (*.cfg) do ( set temp=%%a set mo=!temp:~16,14! set phase=!temp:~13,2! set dirc=!temp:~0,31! cd !dirc! del sfis.cfg echo [PN]>>sfis.cfg echo MP_PN=!mo!>>sfis.cfg echo RMA_PN=NA>>sfis.cfg echo SN_LENGTH=13>>sfis.cfg echo^.>>sfis.cfg echo [SFIS]>>sfis.cfg echo Enable=!one!>>sfis.cfg echo SFIS_TIMEOUT = 25000>>sfis.cfg echo SFIS_IP=10.5.5.!IP!>>sfis.cfg echo SFIS_Port=5010>>sfis.cfg echo FixtureID=!phase!_!ID!>>sfis.cfg echo LINE=ZT4>>sfis.cfg echo^.>>sfis.cfg echo [Station]>>sfis.cfg if !mo!=T1 call :upload if !mo!=T2 call :check if !mo!=T3 call :check echo FA_Debug=disable>>sfis.cfg echo SfCheckAutoFocus=disable>>sfis.cfg echo^.>>sfis.cfg echo [GrayBox]>>sfis.cfg echo R=255>>sfis.cfg echo G=!zero!>>sfis.cfg echo B=!zero!>>sfis.cfg echo Message="ERROR!">>sfis.cfg echo^.>>sfis.cfg echo [ImageFile]>>sfis.cfg echo Enable=!zero!>>sfis.cfg echo ApplicationPath=fciv.exe>>sfis.cfg echo CheckSumPath=imagefile_12MB.cks>>sfis.cfg echo ConfigPath=param.ini>>sfis.cfg echo BlockName=Options>>sfis.cfg echo ItemName=UpLoadImagePath>>sfis.cfg ) goto end :upload echo ChipId=upload>>sfis.cfg goto eof :check echo ChipId=check>>sfis.cfg goto eof :end end 为什么我加了IF后就会出错? if !mo!=T1 call :upload if !mo!=T2 call :check if !mo!=T3 call :check


2008-8-8 17:59
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
flyinspace
银牌会员





积分 1206
发帖 517
注册 2007-3-25
状态 离线
『第 18 楼』:  

=是赋值 ==是比较。 所以很自然报错咯。




知,不觉多。不知,乃求知
2008-8-8 18:47
查看资料  发短消息 网志   编辑帖子  回复  引用回复
terrytong
中级用户





积分 240
发帖 115
注册 2008-3-10
状态 离线
『第 19 楼』:  

我把那个要处理的文件上传了,哪位高手可以帮忙看看啊,到里是哪里出错了?我写的是: @echo off title set station ID for mPCIe mode con cols=100 lines=20 setlocal enabledelayedexpansion set /p IP=please input the IP number: set /p ID=please input the ID number: set one=1 set zero=0 cd\ d: for /r d:\zt4_rev %%a in (*.cfg) do ( set temp=%%a set mo=!temp:~14,14! set phase=!temp:~11,2! set dirc=!temp:~0,29! cd !dirc! del sfis.cfg echo [PN]>>sfis.cfg echo MP_PN=!mo!>>sfis.cfg echo RMA_PN=NA>>sfis.cfg echo SN_LENGTH=13>>sfis.cfg echo^.>>sfis.cfg echo [SFIS]>>sfis.cfg echo Enable=!one!>>sfis.cfg echo SFIS_TIMEOUT = 25000>>sfis.cfg echo SFIS_IP=10.5.5.!IP!>>sfis.cfg echo SFIS_Port=5010>>sfis.cfg echo FixtureID=!phase!_!ID!>>sfis.cfg echo LINE=ZT4>>sfis.cfg echo^.>>sfis.cfg echo [Station]>>sfis.cfg if !phase!==T1 call :upload if !phase!==T2 call :check if !phase!==T3 call :check echo FA_Debug=disable>>sfis.cfg echo SfCheckAutoFocus=disable>>sfis.cfg echo^.>>sfis.cfg echo [GrayBox]>>sfis.cfg echo R=255>>sfis.cfg echo G=!zero!>>sfis.cfg echo B=!zero!>>sfis.cfg echo Message="ERROR!">>sfis.cfg echo^.>>sfis.cfg echo [ImageFile]>>sfis.cfg echo Enable=!zero!>>sfis.cfg echo ApplicationPath=fciv.exe>>sfis.cfg echo CheckSumPath=imagefile_12MB.cks>>sfis.cfg echo ConfigPath=param.ini>>sfis.cfg echo BlockName=Options>>sfis.cfg echo ItemName=UpLoadImagePath>>sfis.cfg ) goto end :upload echo ChipId=upload>>sfis.cfg goto eof :check echo ChipId=check>>sfis.cfg goto eof :end [ Last edited by terrytong on 2008-8-10 at 10:56 AM ]


附件 1: zt4_rev.rar (2008-8-10 09:40, 7.21 K,下载次数: 1)
2008-8-10 09:40
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
moniuming
银牌会员

永远的菜鸟



积分 1335
发帖 574
注册 2007-11-27
来自 广西
状态 离线
『第 20 楼』:  

echo LINE=ZT4>>sfis.cfg echo^.>>sfis.cfg 这样写当然会多出一个".",把"^"去掉!!!最好写成这种形式: >>sfis.cfg echo. echo [Station]>>sfis.cfg if !mo!==T1 call :upload 加上引号试试?如: if "!mo!"=="T1" call :upload if !mo!==T2 call :check if !mo!==T3 call :check


2008-8-10 10:11
查看资料  发短消息 网志   编辑帖子  回复  引用回复
terrytong
中级用户





积分 240
发帖 115
注册 2008-3-10
状态 离线
『第 21 楼』:  

Originally posted by moniuming at 2008-8-10 10:11: echo LINE=ZT4>>sfis.cfg echo^.>>sfis.cfg 这样写当然会多出一个".",把"^"去掉!!!最好写成这种形式 ...
moniuming兄,我按你说的去改了,但是还是只有第一个目录下没有多余的".",其他的都有多余的"."号啊。我都想了好几天了,都没想明白。 是不是要加什么延时的命令啊在for里面? [ Last edited by terrytong on 2008-8-10 at 10:57 AM ]


2008-8-10 10:56
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
523066680
银牌会员

SuperCleaner


积分 2362
发帖 1133
注册 2008-2-2
状态 离线
『第 22 楼』:  

哈哈,金牌的银牌的会员都来了,为什么没有铜牌的?




2008-8-10 11:02
查看资料  发送邮件  访问主页  发短消息 网志  OICQ (523066680)  编辑帖子  回复  引用回复
terrytong
中级用户





积分 240
发帖 115
注册 2008-3-10
状态 离线
『第 23 楼』:  谢谢各位,问题已解决。

在echo. 前加个call 延时就好了。


2008-8-10 12:53
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
<   <<   [1] [2]  >>
请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: