Support Forums

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

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.
User avatar
hackoo
Posts: 103
Joined: Sat Jan 22, 2011 12:27 am

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

Postby hackoo » Fri Sep 14, 2012 1:06 pm

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:
User avatar
jvierra
Posts: 10021
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Fri Sep 14, 2012 1:22 pm

Not is you use Exec.
The 'Run' method lets you hide the window.
User avatar
jvierra
Posts: 10021
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Sat Sep 15, 2012 1:14 am

I think this is what you are trying to do: See attached:


Attached files /FileUpload/1f/107bf3f758738db6360717260a6772.zip (927 B)
User avatar
jvierra
Posts: 10021
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Sat Sep 15, 2012 1:28 am

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.

Return to “Other Scripting Languages”

Who is online

Users browsing this forum: No registered users and 4 guests