[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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
hackoo
Posts: 103
Last visit: Tue Apr 26, 2016 9:02 am

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

Post 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:
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post by jvierra »

Not is you use Exec.
The 'Run' method lets you hide the window.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post by jvierra »

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


Attached files /FileUpload/1f/107bf3f758738db6360717260a6772.zip (927 B)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked