I'm writing a HTA script "Opslag.hta", from which I want to open another HTA script "update.hta".
I'm trying to open "update.hta", which is located in a subfolder (include) to the primary script:
Set objShell = CreateObject("WScript.Shell")
UpdatePath = "include\update.hta"
objShell.Run (chr(34) & UpdatePath & chr(34))
However I'm getting the error "File Not Found" and when I'm prompted if I want to continue running scripts and press "Yes" the "update.hta" actually opens.
I have tried to move the "update.hta" script to different locations and even tried to specify the full path for "update.hta" in "UpdatePath". I have tried with vbQuote, double backslashes (since the "Opslag.hta" is located in a path with spaces) and every possible solution I could find, without succes.
This thread: File not found when using objshell.run -- vbscript, did not help me unfortunately.
I'm running on a Windows 7, 64 bit - don't know if that has anything to do with it.
I really hope someone here has the answer as I'm about to got nuts! =)
Thank you in advance!
Note: I'm not sure this is really an answer, but as requested... this is how i saw it:
Reading the code
there are two alternatives
update.hta
can not be found. In this case there will be an error and thehta
file will not be openedupdate.hta
can be found. In this case there will be no error and thehta
file will be openedBut none of these alternatives match the observed behaviour. The
hta
file is opened, so it is found. But a error is shown. Since the code in the caller does not include anything that could case the error, the source of the error should be in the called file.