HTM Dynamic Multi-Selection List Box with a batch backbone

Posted on 2010-09-19
Medium Priority
Last Modified: 2012-08-13
I've created a batch file that reads keys in the registry and then lists the relevant keys in a text file. I'm attempting to create a GUI for this batch that will allow the user to view the keys and then select what he/she wants to delete (basically reinventing HijackThis but for our own purposes). I figured I could do this with HTM just because there are a lot of tools out there to write this but as it turns out, I just don't know HTM coding and I can't figure out how to do this.

So here's the idea, the batch exports a tmp file whose name specifies where the key is located (eg: HKLMRun.tmp or HKLMShell.tmp). I'd like to create something that reads that text file and lists the contents in a Multi-Selection List Box and then just click a button that runs a batch file with a parameter (something like “delkey.bat” HKLMRun mySelection(i)). I have no problem with the Batch side; the HTM/JS side has left me at a standstill.

The batch is already ready to export in the following two formats:
“    [VALUE ]   [DATA]”

(A more human friendly)

“Value:     [Value]”
“Data: [Data]”

The “DATA” side is actually irrelevant to the functionality and is really only there for the user to see.

I realise this all may sound complicated so please feel free to ask me anything about it for clarification. There's no rush on this, I've been playing with it for months now.

Below is the batch side that fuctions just fine, just with no real GUI, user interaction, or fuction, it just reads and displays the keys.


::The def variable will eventually be updated from our servers rather than hard coded in the batch.
SET def=MSASCui.exe winvnc.exe KaUsrTsk.exe egui.exe wcescomm.exe ctfmon.exe Atiptaxx.exe ccApp.exe daemon.exe VPTray.exe VxTaskbarMgr.exe OmniPage 

QuickBooks qttask.exe Symantec mobsync.exe schedhlp.exe cpqteam.exe palmwizard.exe AbyssWebServer sidebar.exe UnlockerAssistant GrooveMonitor

SetLocal EnableDelayedExpansion
ECHO Gathering Info...
SET tempLocation=%temp%\StonewallRegistry
IF NOT EXIST "%tempLocation%" MD "%tempLocation%"
DEL /F/Q "%tempLocation%\*.*"

::Set Tmp Files Names

 SET HKName1=HKCU\Software\Microsoft\Windows\CurrentVersion\Run
 SET HKName2=HKLM\Software\Microsoft\Windows\CurrentVersion\Run
 SET HKName3=HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
 SET HKName4=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
 SET HKName5=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
SET HK6=HKLMUserinit
 SET HKName6=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit


::Export the keys
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Run">"%tempLocation%\%HK1%.tmp"
reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Run">"%tempLocation%\%HK2%.tmp"
reg query "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v load>"%tempLocation%\%HK3%.tmp"
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v load>"%tempLocation%\%HK4%.tmp"
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell>"%tempLocation%\%HK5%.tmp"
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit>"%tempLocation%\%HK6%.tmp"

ECHO Stonewall's Registry Results>>"%tempLocation%\results.txt"
ECHO Date: %Date%>>"%tempLocation%\results.txt"
ECHO Time: %Time%>>"%tempLocation%\results.txt"

::Read the exported registry files
FOR /L %%A IN (1,1,%MaxHK%) DO (
	SET SkipMe=0
	FINDSTR /i "REG_SZ REG_MULTI_SZ REG_BINARY REG_DWORD REG_EXPAND_SZ" "%tempLocation%\!HK%%A!.tmp">"%tempLocation%\!HK%%A!2.tmp"
	FINDSTR /i /v "%def%" "%tempLocation%\!HK%%A!2.tmp">"%tempLocation%\!HK%%A!Bad.tmp"
	FOR /F "usebackq tokens=1,3 delims=	" %%K IN ("%tempLocation%\!HK%%A!Bad.tmp") DO (
		ECHO %%K>>"%tempLocation%\!HK%%A!Bad2.tmp"
		ECHO Value: %%K>>"%tempLocation%\!HK%%A!Bad4.tmp
		ECHO  Data: %%L>>"%tempLocation%\!HK%%A!Bad4.tmp
		ECHO %%K    %%L>>"%tempLocation%\!HK%%A!Bad5.tmp

REM			 ::Tweaks
REM			  ::Keeps keys that are fine from being listed and allows the script to continue
			IF NOT EXIST "%tempLocation%\!HK%%A!Bad2.tmp" (
				SET SkipMe=1
REM			 ::Tweaks

REM	 ::Cleans up the results (someone else wrote this)
	FOR /F "usebackq tokens=* delims= " %%a IN ("%tempLocation%\!HK%%A!Bad2.tmp") DO (
		SET /A N+=1
		IF !N! GTR 3 (
			ECHO %%a >>"%tempLocation%\!HK%%A!Bad3.tmp"
		) ELSE (
			SET str=%%a
			SET str=!str:"=!
			ECHO !str! >>"%tempLocation%\!HK%%A!Bad3.tmp"

REM	 ::Lists the results in the command window
	IF !SkipMe! EQU 0 (
		ECHO Found inside !HKName%%A!
		TYPE "%tempLocation%\!HK%%A!Bad4.tmp"
REM		 ::List the results in the txt file to be read (or saved) by the user
		ECHO *********************************************************************************************>>"%tempLocation%\results.txt"
		ECHO Found inside !HKName%%A!>>"%tempLocation%\results.txt"
		TYPE "%tempLocation%\!HK%%A!Bad4.tmp">>"%tempLocation%\results.txt"
		ECHO *********************************************************************************************>>"%tempLocation%\results.txt"

ECHO Data has been stored in "%tempLocation%\results.txt"
notepad "%tempLocation%\results.txt"


Open in new window

Question by:nct1

Author Comment

ID: 33712876
BTW, I'm plan to add a lot more keys to be read and tweaks for the keys, this part was just a test.

Accepted Solution

VeganBen earned 2000 total points
ID: 33713003
This sounds like a lot, but it's not so bad really.

First off, you have to get your txt file in a format which can be more easily read by javascript.

You can obviously "do" programming, so a quick glance at www.json.org will sort you out with a data structure.

Expert Comment

ID: 34422727
Could you post a few lines of the "results.txt" file so that the front-end could more easily be designed based on the exact data format?

I've made quite a few "Hypertext Application" (HTA) GUIs for things that I have to do over and over that require more interactivity than a simple script can provide.  A HTA doesn't have the browser-host security restrictions involved like a plain HTML solution would even though it runs in IE.  My projects have included Dynamic HTML based on source files almost exactly like what you're proposing so it shouldn't be hard to adapt one to do what you need.

Would it matter if it used Javascript or VBScript?  I'm much more familiar with VBScript and since it would be an HTA running in IE only, either language would work fine.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question