欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

vbs 复制指定文件到指定目录下

程序员文章站 2022-06-10 07:52:00
复制指定文件到指定目录下 核心代码 set fso=createobject("scripting.filesystemobject") function copyfil...

复制指定文件到指定目录下

核心代码

set fso=createobject("scripting.filesystemobject")
function copyfiletopath()
srcpath = createobject("scripting.filesystemobject").getfile(wscript.scriptfullname).parentfolder.path
dstpath = "c:\program files\aebell_debugtool\debugtool\dll\figclient\"
fso.copyfile srcpath&"\"&"figclient.exe",dstpath,true
end function

' 'call copyfiletopath()

代码二

sourcefilepath="c:\names\names.nsf"
desfilepath="d:\name_backup\name"&""&year(date)&-month(date)&-day(date)&" "&hour(time)&-minute(time)&"\"
set fso=createobject("scripting.filesystemobject")
if not fso.folderexists(desfilepath) then
fso.createfolder desfilepath
fso.copyfile sourcefilepath,desfilepath
end if

其实原理都是一样的。

相关标签: VBS复制文件