我有以下要添加的VBScript,但我需要帮助才能完成。
目前我有下面的脚本,询问我希望它被调用的文件名,然后创建一个文件夹并移动其中的确定。
我想要添加的是在创建文件夹后我需要一个带有YES / NO选项的命令框,如果我单击是,我需要将文件移动到C:\ DOCUMENTS \ A,如果不是,我需要它移到C:\ DOCUMENTS \ B。
点击“是”或“否”并移动文件夹后,我需要打开文件夹A或B进行查看。
任何想法?
Option Explicit
Const strDLFolder = "C:\Downloads"
Dim objFSO, objWShell, objDLFolder, strNewFolder, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWShell = CreateObject("WScript.Shell")
If Not objFSO.FolderExists(strDLFolder) Then objFSO.CreateFolder(strDLFolder)
objWShell.CurrentDirectory = strDLFolder
Set objDLFolder = objFSO.GetFolder(strDLFolder)
If objDLFolder.Files.Count = 0 Then WScript.Quit
Do
Err.Clear
strNewFolder = InputBox("Folder Name", vbLf & "Enter the name of the folder to be created:")
If strNewFolder = False Then WScript.Quit
On Error Resume Next
objFSO.CreateFolder strNewFolder
Loop While Err.Number <> 0 Or Not objFSO.FolderExists(strNewFolder)
On Error Goto 0
For Each objFile In objDLFolder.Files
objFSO.MoveFile objFile.Name, strNewFolder & "\"
Next
objWShell.Popup "All files moved.", 0, "Done", vbInformation Or vbSystemModal Or &h00040000&