我正在尝试使用代码located here,并对HTA进行一些调整。它起到了作用:
Set wshShell = WScript.CreateObject( "WScript.Shell" )
变为:
Set wshShell = CreateObject( "WScript.Shell" )
弹出窗口出现,但在我点击之前它不会消失。我需要它在进程运行时出现,然后在结束时消失。为什么我的执行没有这样做?
ProgressMsg "Copying, Please wait.", "File Being Copied"
strCMD = "cmd.exe /c robocopy " & strLocalSemesterCourse & " " & strServerSemesterCourse &" " & strFileName & " /LOG+:" & strLogName & " /V /FP /TEE"
nReturn = objShell.Run(strCMD, 1, true)
ProgressMsg "", "Finished"
答案 0 :(得分:0)
您需要将objProgressMsg
定义为全局变量才能实现此目的:
Dim objProgressMsg
...
ProgressMsg "Copying, Please wait.", "File Being Copied"
strCMD = "cmd.exe /c robocopy " & strLocalSemesterCourse & " " _
& strServerSemesterCourse &" " & strFileName & " /LOG+:" & strLogName _
& " /V /FP /TEE"
nReturn = objShell.Run(strCMD, 1, true)
ProgressMsg "", "Finished"
如果没有全局变量,ProgressMsg()
将使用本地变量objProgressMsg
。函数退出后,局部变量不会保留其值,因此每次调用函数时变量都将为空。