Echo Fails why?

Hewlett-packard / Sd2100
March 5, 2010 at 23:45:30
Specs: Windows 7, 1024

set HTA=TEST.hta

echo.<html> >>%HTA%


the screen flash an error cant see what it says.

thank you

See More: Echo Fails why?

Report •

March 6, 2010 at 00:07:09
< and > have special significance to the Command Interpreter. In order to echo them as literals they have to be escaped e.g. ^< and ^>

Report •

March 6, 2010 at 01:39:22
thank you that helped!.

once last Question

why does my script show code in my HTA window? i dont see the problem. thank you all.

<body bgcolor="white">
Maintenance Menu!

<SCRIPT Language="VBScript">
Sub Window_Onload
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
intLeft = (intHorizontal - 300) / 2
intTop = (intVertical - 400) / 2
window.resizeTo 400,300
window.moveTo intLeft, intTop
End Sub
<SCRIPT Language="VBScript">
Sub TestSub
For Each objButton in RadioOption
If objButton.Checked Then
Msgbox "You selected " & objButton.Value & "."
End If
End Sub

Sub TestSub2
If OptionChooser.Value <> 0 Then
Msgbox "You selected Option " & OptionChooser.Value & "."
End If
End Sub


<input type="radio" name="RadioOption" value="1">Maintenance!

<input type="radio" name="RadioOption" value="2">Switch To Advanced View!

<input type="radio" name="RadioOption" value="3">Exit!

<input id=runbutton class="button" type="button" value="Change Menu" name="run_button" onClick="TestSub">

<select size="1" name="OptionChooser" onChange="TestSub2">

<option value="0"></option>
<option value="1">Delete Temporary files!</option>
<option value="2">Defragment files!</option>
<option value="3">Check a HDD for errors!</option>
<option value="4">Network Repair!</option>
<option value="5">Run all Tasks!</option>
<input id=runbutton class="button" type="button" value="Run Chosen Task" name="run_button" onClick="TestSub2">



Report •

March 6, 2010 at 06:50:02
it looks like you need to remove the "</script>" tag here:
<SCRIPT Language="VBScript">
Sub TestSub

Report •

Related Solutions

March 6, 2010 at 06:55:16
"the screen flash an error cant see what it says. "

HINT: test your bat scripts at the prompt.

Helping others achieve escape felicity


Report •

March 6, 2010 at 08:55:58
thank you all ! i cant believe i didnt see that. oh well.

i created that menu for one of my batchs, how would i pass arguments from the HTA back to the batch file?


thank you again !

Report •

March 6, 2010 at 11:41:29
there's prob'ly better ways, but the only way i can think of offhand is to write them out to a textfile.

Report •

March 6, 2010 at 11:51:29
see what i was doing as i ran the HTA from within the batch and just >test.txt to get the return of what was selected from the HTA.

then used findstr and searched the for the return from the HTA, but it doesnt work. the code is right but i cant figure out how to start the HTA correctly from with in the batch to write the return to the text file to move the batch.

if that makes sense.

EDIT: i noticed that the test.hta>text.txt doesnt write what is selected.

Report •

March 6, 2010 at 15:07:56
maybe post the batch part of the operation - your batch script that invokes the hta.
the hta would have to be able to write to standard output in order for the batchfile to pick it up like you described, and i don't know of a way for html to do that. (an html or vba guru might).
i couldn't even find a way to write to the environment table, which would be another way if you can figure out how to do that.
otherwise, it's fso.opentextfile..ofile.writeline..ofile.close

Report •

March 6, 2010 at 15:15:05
thats the issue,

if i can call the HTA from the batch it would be easier. but i dont know a command that allow me to while write the output of the HTA to a text file. if i could do that then i could just use FINDSTR and goto command. problem solved.

but first need to beable to call it from the batch. thats my first issue. maybe only.

Cscript nor Wscript dont work. says no script engine for hta.

Report •

March 6, 2010 at 17:39:44
any HTML people out there that could help me out? the people here so far got me in the right place.

now i hit a wall and stuck.

thank you all.

Report •

March 6, 2010 at 19:24:24
why won't this work (from batch):
start cleanup.htm
or alternatively:
start cleanup.hta

both ways worked over here, but i did get the nuisance "activex may not interact..." dialogue box when i added the write-to-file, but only in the htm, not when exec as hta.
(There's probably a way to disable that, but my cursory attempts did not succeed.
of course, the safety is important since it's writing a file, but only the local "intranet" security settings need to be overridden, not the internet ones.)
the hta flew just fine and did the write-to-file.
your batch would just need to pick up the outputfile and process it.
ps: warning, i'd never even heard of "hta" until this thread!

Report •

March 6, 2010 at 21:45:28
thank you for you help,

yes i know i can start it like you did. but i for some reason cant write to a output file, those popup boxes should not popup and just write that info to the output file and then move on in the batch file.

all my batch does is start the HTA and then next is use of the FINDSTR&&goto if i could get the HTA/HTM to write the output it'd work.

Report •

March 6, 2010 at 22:05:59
i did another test, batch invocation:
start /w cleanup.hta

the batchfile waited patiently until i closed the hta window, then proceeded. might give this a shot.
the batchfile, upon resumption after hta window is closed, can then test for existance of text file. The hta window has to be closed, though, it won't feed in "real-time" back to the batch. the batch "waits" for the ultimate outcome of the hta.

i do feel like a dummy here, so feel free to post a "fresh" thread on this specific subject (the original thread subject is outdated, you need to get some competent people interested...)

Report •

March 6, 2010 at 22:18:26
i guess we would have to edit the HTA/vbs to write to a output file then it will work.

BUT im not sure how. MSGBOX was to write to the file and not popup.

so i guess now the question is how would i write in the sub routines so when a button or drop option is select have it write to the output and close the HTA.

hmm. time to read us someone here can help.

thank you for your time.

Report •

March 7, 2010 at 00:16:47
ok i got it figured out.

for those interested i added this to write the output of the selections

Sub TestSub
For Each objButton in RadioOption
If objButton.Checked Then
Stuff = objButton.Value

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("BrockTest.txt", 8, True)

End If

EDIT: add window.Close() to close the HTA when option selected.

thank you all for the help

Report •

Ask Question