1

我正在尝试使用位于此处的代码,并对 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"
4

1 回答 1

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。局部变量在函数退出后不会保留其值,因此每次调用函数时变量都会为空。

于 2013-07-30T17:58:20.797 回答