[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1239
  • Last Modified:

Batch file to hta

HI everyone,

I have the following batch file that I would like to convert to a hta.

Syntax for running it is as follows:

checkhotfixes.bat <computer_name> <hotfixes_list>.txt <output_results>.txt

What id like to do is:

a) Convert this to a hta
b) Have a list box on the hta that takes the place of the text file that lists all hotfixes to be checked.
c) Have a text box that enables you to input the computer name you wish to check
d) A "Run" button that allows you to execute the script
e) Output would be seen in the hta and not written to a text file

Any help on converting this script to a hta would be much appreciated.
@echo off
rem -------------- checkhotfixes.bat
rem -------------- checkhotfixes.bat <computer_name> <hotfixes_list>.txt <output_results>.txt
rem -------------- eg. checkhotfixes.bat serverA kb.txt kbresults.txt
ECHO System: %1>>%3
ECHO KBs to check from %2:>>%3
ECHO KB:          Status:>>%3
ECHO ------------------------->>%3
FOR /f %%k in ('type "%2"') do (
    Set Status=Not installed
    reg query "\\%1\hklm\software\microsoft\windows nt\currentversion\hotfix\%%k" /v Installed | FIND /i "Installed" | FIND "0x1"
    IF NOT ERRORLEVEL 1 Set Status=Installed
    ECHO %%k    !Status!>>%3

Open in new window

1 Solution
Simon, copy similar process I posted for you in http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24326322.html.

You'll need to convert the batch script to VBScript.  Shouldn't be too hard, will need to use a VBscript for loop.  (I always had trouble deciphering batch loops tho :-) )

To output text to the HTA, use the HTML tag <DIV id="TextOutput></DIV>.   Then update if from your script by:
  TextOutput.Value = "text ..."
  TextOutput.Value = TextOutput.value & vbnewline & "new text..."
Simon336697Author Commented:
Thanks so much sj

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now