U盘文档自动备份

检测到插入U盘即复制其中doc、ppt文件到指定目录

(ucopy.bat):

@echo off
:again
del /Q /f "%temp%\copy.tmp" >nul 2>nul
for %%i in (d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) do @fsutil fsinfo drivetype %%i: >>"%temp%\copy.tmp"
findstr /i "可移动驱动器" "%temp%\copy.tmp" 
if errorlevel==1 goto end
if errorlevel==0 goto copy 
:end 
echo 不存在
ping 127.0.0.1 -n 20 >nul 2>nul
goto again
:copy
if exist c:\copy goto goon
cd\
cd /d c:
md copy  
:goon
for /f "tokens=1" %%i in ('findstr /i "可移动驱动器" "%temp%\copy.tmp"') do (
for /f "tokens=*" %%j in ('dir/s/b %%i\*.ppt %%i\*.doc?') do (
copy %%j c:\copy /y))
ping 127.0.0.1 -n 20 >nul 2>nul
goto again

隐藏bat进程

(ucopy.vbs)

set ws=WScript.CreateObject("WScript.Shell") 
ws.Run "u.bat",0

执行ucopy.vbs

posted @ 2018-10-08 12:35  Vicen  阅读(243)  评论(0编辑  收藏  举报