Question

I'm trying to run this command:

mshta javascript:alert("Thanks for taking a look at my question! :D");close();

It runs fine in the cmd prompt, but when placed in a batch file, I get this error:

close() was unexpected at this time.
Was it helpful?

Solution

In the batch script, the semi-colon is terminating the mshta command, instead of the HTA command like you want it to. You'll have to quote the HTA command, or provide a script to mshta.exe.

I think that this should work:

mshta "javascript:alert('Thanks for taking a look at my question! :D');close();"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top