中国DOS联盟论坛

中国DOS联盟

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

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

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 资料move失败如何提示出来让使用者知道呢?
作者:
标题: 资料move失败如何提示出来让使用者知道呢? 上一主题 | 下一主题
acme
中级用户




积分 238
发帖 98
注册 2007-4-10
来自 陕西
状态 离线
『楼 主』:  资料move失败如何提示出来让使用者知道呢?

我用以下的批处理来完成资料的转移储存,请教大哥如何实现在资料move失败后提示出来呢?《如以下红色部分》
----------------------------------------------------------------------------------------------------
@echo off
schtasks /create /tn pcl /tr (e:\move-9)/sc once /st (23:15:00)
set dd=%time:~0,2%
if "%dd%"=="23" goto mm

:open
echo ============================================
echo 友情提示:
echo         目前不是AOI资料转移系统设置运行时间!
echo         您需要强制运行系统吗?会造成资料异常!
echo         需要强制执行请输入Y,推出系统请输入N!
echo ============================================
SET /P ST=请输入 Y 或 N:
If /I "%ST%"=="Y" goto mm
if /I "%ST%"=="N" goto exit

:mm
echo *****欢迎使用AOI资料移动系统*****
echo 资料夹建立中,请稍候.......
e:
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ALINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\BLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\CLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\DLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ELINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\FLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\GLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\HLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ILINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\JLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\KLINE\%%i%%j%%k
echo 完成建立!
echo 资料转移中,请稍候......!
set aa=%date:~4,10%
move \\AREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ALINE\%aa%\
move \\BREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\BLINE\%aa%\
move \\CREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\CLINE\%aa%\
move \\DREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\DLINE\%aa%\
move \\EREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ELINE\%aa%\
move \\FREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\FLINE\%aa%\
move \\GREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\GLINE\%aa%\
move \\HREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\HLINE\%aa%\
move \\IREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ILINE\%aa%\
move \\JREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\JLINE\%aa%\
move \\KREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\KLINE\%aa%\

echo =============================================
echo                   转移完毕!
echo         Press any key to continue......
echo =============================================
echo. & pause
Exit

: exit
ping /n 1 127.1
echo =================
echo 您选择了推出系统!
echo =================
ping /n 5 127.1
exit



一切皆有可能!我行!我能!
2007-5-25 22:36
查看资料  发送邮件  访问主页  发短消息 网志  OICQ (422076812)  编辑帖子  回复  引用回复
lxmxn
版主




积分 11386
发帖 4938
注册 2006-7-23
状态 离线
『第 2 楼』:  

在红色代码的后面加上" || echo 失败 " 试试.

2007-5-25 23:13
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
bjsh
银牌会员





积分 2000
发帖 621
注册 2007-1-1
状态 离线
『第 3 楼』:  

for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ALINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\BLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\CLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\DLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ELINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\FLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\GLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\HLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\ILINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\JLINE\%%i%%j%%k
for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do md E:"\AOI SYSTEM TEST RECORD"\2007\KLINE\%%i%%j%%k
建议改成:

for %%l in (A B C D E F G H I J K) do (
        for /f "tokens=1-3 delims=\" %%i in ('echo %date:~4,10%') do (
                md E:"\AOI SYSTEM TEST RECORD"\2007\%%lLINE\%%i%%j%%k
        )
)

同样
move \\AREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ALINE\%aa%\
move \\BREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\BLINE\%aa%\
move \\CREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\CLINE\%aa%\
move \\DREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\DLINE\%aa%\
move \\EREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ELINE\%aa%\
move \\FREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\FLINE\%aa%\
move \\GREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\GLINE\%aa%\
move \\HREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\HLINE\%aa%\
move \\IREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\ILINE\%aa%\
move \\JREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\JLINE\%aa%\
move \\KREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\KLINE\%aa%\
这个改成
for %%i in (A B C D E F G H I J K) do move \\%%lREPAIR\DDRIVER\REPAIR\*.* E:\"AOI SYSTEM TEST RECORD"\2007\%%iLINE\%aa%\ || echo "Failed"

2007-5-26 08:52
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
kgdetg1127
初级用户





积分 158
发帖 89
注册 2007-4-25
状态 离线
『第 4 楼』:  

顶一下。

2008-1-8 22:32
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


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



论坛跳转: