Page 1 of 1

[HTA] How to hide the CMD prompt on HTA Script ?

Posted: Fri Sep 14, 2012 1:06 pm
by hackoo
Hi !
I wonder if there are any tricks or tips can be done to hide the CMD prompt when I execute this HTA script?
Thank you !
http://www.paulsadowski.com/wsh/Trace.hta.htm


Traceroute





set objShell = CreateObject("WScript.Shell")
strOut=""

sub traceroute
cmdarg="%comspec% /c tracert.exe " & T1.value
set objExCmd = objShell.Exec(cmdarg)

strOut=objExCmd.StdOut.ReadAll

Set regEx = New RegExp
regEx.Pattern = "[fnrv]+"
regEx.Global = True
regEx.Multiline = True
strOut = regEx.Replace(strOut, "")
TraceOut.innerHTML= strOut
end sub
//-->

Traceroute HTA by Paul R. Sadowski (11/2001)
Hostname:

[HTA] How to hide the CMD prompt on HTA Script ?

Posted: Fri Sep 14, 2012 1:22 pm
by jvierra
Not is you use Exec.
The 'Run' method lets you hide the window.

[HTA] How to hide the CMD prompt on HTA Script ?

Posted: Sat Sep 15, 2012 1:14 am
by jvierra
I think this is what you are trying to do: See attached:


Attached files /FileUpload/1f/107bf3f758738db6360717260a6772.zip (927 B)

[HTA] How to hide the CMD prompt on HTA Script ?

Posted: Sat Sep 15, 2012 1:28 am
by jvierra
Note that the code, as posted on the linked web site, is incorrect and will not always display correctly. The HTML is incomplete and structured poorly.

The links on the page are old and no longer functional. The statement that Exec is not available in older versions of WSH has not been true since Windows 2000 which is almost 14 years ago.

It appears that this page was copied blindly from somewhere or it has been broken or hacked by someone. It also does not show a knowledge of the fundamentals of scripting or of HTML.

I would be careful using this code as a model for anything as it uses methods and techniques that are very misleading to anyone wishing to learn to script.

You should focus your attention on the scripting lesssons on the MS technet site or purchase one of the Sapien books. Getting a proper understanding of the fundamentals is critical and will save you a lot of time.