我有一组文件夹/子文件夹组合。我的子程序获取文件夹组合,以及常量路径和提供的日期戳,并构建命令,返回变量“rcmd” -
For each location in myArray
Call RoboCopy
MsgBox rcmd
Next
'Sub for the robocopy command
Sub RoboCopy
infolder = location
arr2 = Split(location,"\")
outfolder = arr2(0)
rcmd = "robocopy " & IN_PATH & "\" & infolder & " " & OUT_PATH & "\" _
& outfolder & " /XO /MAXAGE:2 /NP /Log+:C:\OKC_v13_to_v15_copy_" & stamp & ".log"
End Sub
如您所见,我现在有“MsgBox”帮助。MsgBox 始终正确显示我需要的命令。但是,一旦我尝试将其更改为-
For each location in myArray
Call RoboCopy
Wsh.Run rcmd, 0, true
Next
它什么也没做。我是否需要提供我试图以不同方式运行 Wsh.Run 的命令?顺便说一句,Wsh 已经被定义为 WScript.Shell。