::设定存档路径
set emx_path="\\server\工程部"
set xqg_path="\\server\线切割"
set cnc_path="\\server\电脑锣"
::检查网络是否通畅
for %%d in (%emx_path%,%xqg_path%,%cnc_path%) do if not exist %%d echo **errr:存档路径%%d不存在,请检查网络! & pause & exit
set emx=0 & set dwg=0 & set bom=0 & set xqg=0 & set cnc=0
cd %1
echo %cd%>%temp%\1.txt
:start
::从文件1.txt截取第一个\之后的内容并重新分配到变量x
for /f "eol=S TOKENS=1,* DELIMS=\" %%a in (%temp%\1.txt) DO set x=%%b
::如果变量x存在则设mold为x并将变量x写入到1.txt在返回到:start,直到不能重设变量x,这样获得最后一个x为mold
if defined x set mold=%x% && echo %x%>%temp%\1.txt && goto :start
call :make %mold%
:make
::循环比较取得模具所属客户
for %%s in (CM1 CM2 CM3 CM4 CM5 CM6 CM7) do if /i %1 GEQ %%s set CMx=%%s
IF /i %CMx% EQU CM7 echo 模号归属%CMx%不正确,终止! && pause & exit
echo 当前模号:%1,归属于:%CMx%X
pause
::设置变量
if exist emx set emx=1
if exist %1.dwg set dwg=1
if exist %1_bom.xls set bom=1
if exist %1.dwg set xqg=1
if exist emx set cnc=1
goto :done
:done
::执行命令
if %emx%==1 goto :emx %1
if %dwg%==1 goto :dwg %1
if %bom%==1 goto :bom %1
if %xqg%==1 goto :xqg %1
if %cnc%==1 goto :cnc %1
goto :end
:emx
::假如有旧版本,清除
if exist %emx_path%\%CMx%X\%1\emx rd %emx_path%\%CMx%X\%1\emx /s/q & echo 原有emx档案已经清除
::假如没有文件夹,创建
if not exist %emx_path%\%CMx%X\%1\emx md %emx_path%\%CMx%X\%1\emx
::复制并回显是否成功
xcopy emx %emx_path%\%CMx%X\%1\emx /Y/S/E/C/Q & echo 已存档:emx到..\2DMOLD\%CMx%X\%1 & set emx=2
goto :done
:dwg
::假如没有文件夹,创建
if not exist %emx_path%\%CMx%X\%1 md %emx_path%\%CMx%X\%1
::复制并回显是否成功
xcopy %1.dwg %emx_path%\%CMx%X\%1 /Y/C/Q/H & echo 已存档:%1.dwg到..\2DMOLD\%CMx%X\%1 & set dwg=2
goto :done
:xqg
color 2C
::提示给用户选择
choice 如果用于审图,无需继续操作,是否继续?
if errorlevel 2 goto :end
::删除今日保存的旧版本
if exist %xqg_path%\今日线割\%1_%date% rd %xqg_path%\今日线割\%1_%date% /s/q
if exist %xqg_path%\今日线割\%1 rd %xqg_path%\今日线割\%1 /s/q
md %xqg_path%\今日线割\%1
::复制并回显
xcopy %1.dwg %xqg_path%\今日线割\%1\ /Y/C/Q/H
::检查是否有旧的线割图便于决定是否加上当前日期,然后回显
if exist %xqg_path%\%CMx%--X\%1\%1.dwg ren %xqg_path%\今日线割\%1\%1.dwg %1_%date%.dwg && ren %xqg_path%\今日线割\%1 %1_%date% && echo 已存档:%1.dwg到..\今日线割\%1_%date% && set xqg=2
if exist %xqg_path%\今日线割\%1 echo 已存档:%1.dwg到..\今日线割\%1 && set xqg=3
goto :done
:cnc
color 3D
::提示给用户选择
choice 如果用于改模,无需继续操作,是否继续?
if errorlevel 2 goto :end
cd emx
if not exist %cnc_path%\%1 md %cnc_path%\%1
::复制并回显是否成功
if exist %1_moldbase.asm.* xcopy %1_moldbase.asm.* %cnc_path%\%1 /Y/S/E/C/Q/H
for %%n in (a b c e f t s r l) do if exist %1_%%np1.prt.* xcopy %1_%%np1.prt.* %cnc_path%\%1 /Y/S/E/C/Q
echo 已存档:模板图到..\3D模胚文件夹\%1
cd..
set cnc=2
goto :done
:end
if exist %temp%\1.txt del %temp%\1.txt
choice 存档成功是否打开文件夹检查?
if errorlevel 2 exit
start explorer %emx_path%\%CMx%X\%1
if %xqg%==2 start explorer %xqg_path%\今日线割\%1_%date%
if %xqg%==3 start explorer %xqg_path%\今日线割\%1
if %cnc%==2 start explorer %cnc_path%\%1
exit作者: 干锅肥肠 时间: 2008-6-18 22:30
不错,