中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-09 11:10
47,811 主题排行 / 349,895 发帖 / 今日 0 篇 / 48,253 会员排行
DOS批处理 & 脚本技术(批处理室) » 【求助】怎么向文本文件加入空行
可打印版本  2,325 / 22
第16楼 terrytong 发表于 2008-08-08 17:09
中级用户 发帖 115 积分 240
Originally posted by HAT at 2008-8-8 11:54:
用cd不要紧,在后面判断一下就行了。
否则,如楼上所说,早晚要后悔。

我判断过了,cd !dirc! 没有问题。
但是结果为:

MP_PN=1602-276201-02
RMA_PN=NA
SN_LENGTH=13
.

Enable=0
SFIS_TIMEOUT = 25000
SFIS_IP=10.5.5.80
SFIS_Port=5010
FixtureID=T1_27
LINE=ZT4
.

ChipId=none
FA_Debug=disable
SfCheckAutoFocus=disable
.

R=255
G=0
B=0
Message="ERROR"
.

Enable=0
ApplicationPath=fciv.exe
CheckSumPath=imagefile_12MB.cks
ConfigPath=param.ini
BlockName=Options
ItemName=UpLoadImagePath
第17楼 terrytong 发表于 2008-08-08 17:59
中级用户 发帖 115 积分 240
@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 >>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.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 >>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 >>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 >>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
第18楼 flyinspace 发表于 2008-08-08 18:47
银牌会员 发帖 517 积分 1,206
=是赋值

==是比较。

所以很自然报错咯。
第19楼 terrytong 发表于 2008-08-10 09:40
中级用户 发帖 115 积分 240
我把那个要处理的文件上传了,哪位高手可以帮忙看看啊,到里是哪里出错了?我写的是:
@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 >>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.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 >>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 >>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 >>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 ]

附件
zt4_rev.rar (7.21 KiB)
第20楼 moniuming 发表于 2008-08-10 10:11
银牌会员 发帖 574 积分 1,335 来自 广西
echo LINE=ZT4>>sfis.cfg
echo^.>>sfis.cfg 这样写当然会多出一个".",把"^"去掉!!!最好写成这种形式: >>sfis.cfg echo.
echo >>sfis.cfg
if !mo!==T1 call :upload 加上引号试试?如: if "!mo!"=="T1" call :upload
if !mo!==T2 call :check
if !mo!==T3 call :check
第21楼 terrytong 发表于 2008-08-10 10:56
中级用户 发帖 115 积分 240
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 ]
第22楼 523066680 发表于 2008-08-10 11:02
银牌会员 发帖 1,133 积分 2,362
哈哈,金牌的银牌的会员都来了,为什么没有铜牌的?
第23楼 terrytong 发表于 2008-08-10 12:53
中级用户 发帖 115 积分 240
谢谢各位,问题已解决。
在echo. 前加个call 延时就好了。
上一页  1 2
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023