Академический Документы
Профессиональный Документы
Культура Документы
IMAGEX is a fantastic tool, but it has a command line that can, at times, be way too
complicated. As of yet, there is no official, nice, easy-to-use interface or GUI to simplify the
whole thing although a couple of people have posted DIY ones on the web with various levels of
success.
My current client needed a simplified way of creating a WIM file for use during the BDD project
I am working on; they are using WIM files as a means of applying files to a computer, similar to
just creating a ZIP file and extracting the contents. Anyway, I was asked if Microsoft had
something (or could create something) that he could give to a junior member of staff so that s/he
could create these WIM files without making mistakes or getting confused with the command
line. So, I created a very simple HTA file which will do exactly what he asked for. Seeing as he
liked it so much I thought that I would share it here so that others can take advantage of it.
Feel free to use/abuse/butcher/amend/correct/revise/recycle any or all of the code for your own
use. Of course, I must mention the usual disclaimer: USE AT YOUR OWN RISK! THIS IS
NOT 100% TESTED CODE.
Unfortunately, it does come with 3 requirements. The first is that it is run with administrative
permissions. This is not a problem with Windows XP if you are an admin on the box but with
Windows Vista you'll need to run it elevated (Windows Vista does not give you the "Run as
Administrator" option for HTA files so you'll need to elevate a cmd prompt first, then run the
HTA. The second is that you have the file imagex.exe in the same folder as the HTA file, and the
third is that you have already installed the imagex filter driver. Installing the filter driver is easy
to do, either install the WAIK on your computer or just right click on the .inf file which you will
find in the same folder as imagex.exe on a computer that has the WAIK installed and choose
"install".
To use: simply copy the code below and paste it (careful with the wordwrap)into notepad. Save
the file with the .hta extension and then you are ready to run it, a simple double-click and you are
away! Enjoy.
<head>
<title>WIMCreator</title>
<HTA:APPLICATION
APPLICATIONNAME="IMAGEX - CAPTURE HTA"
MAXIMIZEBUTTON="NO"
MINIMIZEBUTTON="NO"
SCROLL="NO"
SHOWINTASKBAR="YES"
SINGLEINSTANCE="YES"
WINDOWSTATE="NORMAL"
SYSMENU="YES"
>
</head>
<script language="VBScript">
Sub Window_onLoad
Dim path
Set fso = CreateObject("scripting.filesystemobject")
path = fso.getabsolutepathname(".")
CurrFolder.InnerHTML = CurrFolder.InnerHTML & " " & path
if fso.FileExists(path & "\imagex.exe") = false then
Msgbox "IMAGEX.exe does not exist in the same folder as this HTA program."
ImageXExists.checked = false
savefolderbox.disabled = true
savefolderbutton.disabled = true
driversbox.disabled = true
driversbutton.disabled = true
clearvalues.disabled = true
createwim.disabled = true
commentbox.disabled = true
else
ImageXExists.checked = true
end if
End Sub
Function BrowseForSaveLocation
On Error Resume Next
Dim oShell, oFolder, intColonPos, oWshShell
Set oShell = CreateObject("Shell.Application")
Set oWshShell = CreateObject("WScript.Shell")
Set oFolder = oShell.BrowseForFolder(0, "Choose WIM destination folder", &h17,
OPTIONS)
BrowseForFolder = oFolder.ParentFolder.ParseName(oFolder.Title).Path
If Err.Number > 0 Then BrowseForFolder = Null
If oFolder.Title = "Desktop" Then BrowseForFolder = owshshell.SpecialFolders("Desktop")
intColonPos = InStr(oFolder.Title, ":")
savefolderbox.value & "\mywim.WIM" & chr(34) & " " & chr(34) & commentbox.value &
chr(34)
oWshShell.Run imgCMD, , True
End Sub
</script>
<body>
<span><span><span style='font-family: Arial'><span style='font-size: 10pt'>
<span id = "DataArea">Welcome to the WIM creation tool! This tool Is NOT an official
Microsoft product and
this therefore totally unsupported.<br />
<br />
You must execute this program with admin rights!</span><br />
<br />
<hr />
<br />
<span id = "CurrFolder">Current directory:</span>
<br />
<br />
IMAGEX.exe found?
<input id="ImageXExists" type="checkbox" name="imagexexists" checked="CHECKED"
disabled="disabled" /><br />
<br />
<hr />
<br />
</span></span>
</span></span>
<span style='font-size: 10pt; font-family: Arial'>
Path to source folder<br />
</span><input id="DriversBox" name="DriversBox" style='width: 617px; font-size: 10pt;
font-family: Arial;'
type="text" readonly="readOnly" /><span
style='font-size: 10pt; font-family: Arial'> </span>
<input id="DriversButton" type="button" value="Browse..." name="DriversButton"
onclick="BrowseForDrivers"
style='font-size: 10pt; font-family: Arial' /><br />
<br />
<span style='font-size: 10pt; font-family: Arial'>
Location for WIM file to be saved<br />
</span>
<input id="saveFolderBox" name="saveFolderBox" style='width: 617px; font-size: 10pt; fontfamily: Arial;'