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


  本文标签:VBS复制文件

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

核心代码

Set fso=CreateObject("Scripting.filesystemobject")
Function CopyFileToPath()
SrcPATH = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
DstPATH = "C:Program FilesAEBELL_DebugToolDebugTooldllFigClient"
fso.CopyFile SrcPATH&""&"FigClient.exe",DstPATH,True
End Function

' 'Call CopyFileToPath()

代码二

sourcefilepath="c:
ames
ames.nsf"
desfilepath="d:
ame_backupName"&""&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

其实原理都是一样的 。