firebladeboy
2008-03-17 12:28:02 UTC
Hi,
While deploying machines via WinPE 2.0 I'm using imagex.exe cmd to deploy an
image to a pc & I need see imagex progress (so I can't just hide the CMD
window.)
Basically what I'm trying to do is create a nicer UI so I don't have to show
the cmd window itself.. just the output it's giving, so far I have a hta that
will display the output of the cmd window but it will only show this once the
cmd is finished. I think I somehow need to create a loop to view the
contents of the cmd output while it's still running and refresh the hta every
few seconds.. maybe I need to output a temp file and refresh the hta from
that while cmd is still running?
I'm aiming to use this to redirect the output of any cmd window and maybe
call it as a function whenever exe's are being run (file copy / directory
listing / defrag etc).
here is my code so far:
===================
CMDout.hta
===================
<html>
<head><title>CMDOut</title>
<HTA:APPLICATION ID="oHTA";
APPLICATIONNAME="CMDOut";
BORDER="thin";
BORDERSTYLE="normal";
SINGLEINSTANCE="no";
</head><body bgcolor="#E8E8E8" >
<font size=2 face="Century Gothic, Tahoma, Arial" color="black">
<script language="VBScript" type="text/vbscript">
set objShell = CreateObject("WScript.Shell")
strOut=""
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
Next
intLeft = (intHorizontal - 640) / 2
intTop = (intVertical - 480) / 2
window.resizeTo 640,480
window.moveTo intLeft, intTop
cmdarg="%comspec% /c ipconfig.exe "
set objExCmd = objShell.Exec(cmdarg)
strOut=objExCmd.StdOut.ReadAll
Set regEx = New RegExp
regEx.Pattern = "[\f\n\r\v]+"
regEx.Global = True
regEx.Multiline = True
strOut = regEx.Replace(strOut, "<br>")
CMDOut.innerHTML= strOut
end sub
//-->
</script>
<div id=CMDOut></div>
================
any assistance would be greatly appreciated!
Thanks
While deploying machines via WinPE 2.0 I'm using imagex.exe cmd to deploy an
image to a pc & I need see imagex progress (so I can't just hide the CMD
window.)
Basically what I'm trying to do is create a nicer UI so I don't have to show
the cmd window itself.. just the output it's giving, so far I have a hta that
will display the output of the cmd window but it will only show this once the
cmd is finished. I think I somehow need to create a loop to view the
contents of the cmd output while it's still running and refresh the hta every
few seconds.. maybe I need to output a temp file and refresh the hta from
that while cmd is still running?
I'm aiming to use this to redirect the output of any cmd window and maybe
call it as a function whenever exe's are being run (file copy / directory
listing / defrag etc).
here is my code so far:
===================
CMDout.hta
===================
<html>
<head><title>CMDOut</title>
<HTA:APPLICATION ID="oHTA";
APPLICATIONNAME="CMDOut";
BORDER="thin";
BORDERSTYLE="normal";
SINGLEINSTANCE="no";
</head><body bgcolor="#E8E8E8" >
<font size=2 face="Century Gothic, Tahoma, Arial" color="black">
<script language="VBScript" type="text/vbscript">
set objShell = CreateObject("WScript.Shell")
strOut=""
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
Next
intLeft = (intHorizontal - 640) / 2
intTop = (intVertical - 480) / 2
window.resizeTo 640,480
window.moveTo intLeft, intTop
cmdarg="%comspec% /c ipconfig.exe "
set objExCmd = objShell.Exec(cmdarg)
strOut=objExCmd.StdOut.ReadAll
Set regEx = New RegExp
regEx.Pattern = "[\f\n\r\v]+"
regEx.Global = True
regEx.Multiline = True
strOut = regEx.Replace(strOut, "<br>")
CMDOut.innerHTML= strOut
end sub
//-->
</script>
<div id=CMDOut></div>
================
any assistance would be greatly appreciated!
Thanks