求助:U盘插入自动复制脚本,添加按文件修改时间复制内容
vbs吧
全部回复
仅看楼主
level 1
xiaoyongge 楼主
有了2个脚本,都不适合,需要增加按文件修改时间复制内容
脚本1:后台运行,全部复制
set fso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")
on error resume next
do
wscript.sleep 1000
if fso.driveexists("h:\") then
fso.copyfile "h:\*","E:\My Documents\Downloads"
fso.copyfolder "h:\*","E:\My Documents\Downloads"
wscript.sleep 20000
end if
loop
脚本2:提示运行,可以按文件类型复制,不方便,要求也后台运行
set fso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")
dim USB, file, folder, files
USB=inputbox("请输入U盘的盘符"&Chr(10)&"如插入的U盘为F盘,则输入F","插入的U盘盘符","h")
folder=inputbox("请输入复制到的文件夹"&Chr(10)&"如想复制到D盘,请输入D:\","请输入复制到的文件夹","E:\My Documents\Downloads\")
files=inputbox("请输入要复制的文件类型"&Chr(10)&"如要复制EXCEL文件,输入xls;默认为全部类型","请输入要复制的文件类型","ALL")
USB=USB & ":\"
folder=folder & "\"
if files="ALL"then
file=USB & "*"
else
file=USB & "*." & files
end if
if FSO.FolderExists(folder) then
else
FSO.CreateFolder(folder)
end if
on error resume next
do
wscript.sleep 1000
if fso.driveexists(USB) then
fso.copyfile file,folder
fso.copyfolder file,folder
wscript.sleep 20000
end if
loop
2012年02月17日 14点02分 1
level 12
好像已经有现成的吧
2012年02月18日 04点02分 2
level 12
在vbs官方贴吧网盘里
2012年02月18日 04点02分 3
level 7
第一个脚本。。。貌似用fso判断磁盘是否是u盘不行么?自己用的是吧?
2012年02月18日 09点02分 4
level 1
xiaoyongge 楼主
自己用的,两个都能正常复制U盘内容
2012年02月18日 10点02分 5
level 1
xiaoyongge 楼主
官方贴吧找不到啊,请指点一下
2012年02月18日 10点02分 6
level 12
vbscript . ys168 . com
2012年02月19日 09点02分 7
level 12
空格去掉
2012年02月19日 09点02分 8
level 1
xiaoyongge 楼主
谢谢
2012年02月19日 09点02分 9
level 12
不谢
2012年02月19日 09点02分 10
1