Vbscript 尝试复制文件。获取所需对象错误

Vbscript 尝试复制文件。获取所需对象错误

我正在尝试编写一个脚本,当用户提示他们希望将文件移动到哪个文件夹时,该脚本将复制文件。我尝试了此站点上多个不同帖子中的不同方法,每次尝试修复它时,我要么得到 FileObject System 作为必需对象,要么只是“。

我做错了什么?有人可以帮我解决这个问题吗?

Option Explicit
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim FileSystemObject
Dim oFolder
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0,"Select a Folder",0,0)
Dim WshShell, strCurDir
Set WshShell = CreateObject("WScript.Shell")
strCurDir   = WshShell.CurrentDirectory
FileSystemObject.CopyFile strCurDir & "test.txt", oFolder

相关内容