midwestexp
asked on
PE HTA will not run batch file
Building a script in Windows PE to click button to run different Batch files, but i get a error saying "The operation was canceld by the user" when i press the button. Below is the code:
<head>
<title>MEG Windows Install</title>
<HTA:APPLICATION="yes"
APPLICATIONNAME="MEG Windows Install"
SCROLL="No"
SINGLEINSTANCE="yes"
>
</head>
<Script Language="VBScript">
Sub TestSub
Dim WShell
Set WShell = CreateObject("Wscript.Shel l")
WShell.Run "g:\imagex\xp.cmd"
Set Wshell = Nothing
End Sub
</script>
<body>
<center>Please choose a operating system.<br><br><br>
<input type="button" value="Windows XP" name="run_button" onClick="TestSub"><p>
</center>
</body>
<head>
<title>MEG Windows Install</title>
<HTA:APPLICATION="yes"
APPLICATIONNAME="MEG Windows Install"
SCROLL="No"
SINGLEINSTANCE="yes"
>
</head>
<Script Language="VBScript">
Sub TestSub
Dim WShell
Set WShell = CreateObject("Wscript.Shel
WShell.Run "g:\imagex\xp.cmd"
Set Wshell = Nothing
End Sub
</script>
<body>
<center>Please choose a operating system.<br><br><br>
<input type="button" value="Windows XP" name="run_button" onClick="TestSub"><p>
</center>
</body>
ASKER
Did you try it inside a PE enviroment?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sub TestSub
Dim WShell
Set WShell = CreateObject("Wscript.Shel l")
WShell.Run "cmd.exe /k g:\imagex\xp.bat"
End Sub
Dim WShell
Set WShell = CreateObject("Wscript.Shel
WShell.Run "cmd.exe /k g:\imagex\xp.bat"
End Sub
ASKER
This how i fixed.
Sub TestSub
Dim WShell
Set WShell = CreateObject("Wscript.Shel l")
WShell.Run "cmd.exe /k g:\imagex\xp.bat"
End Sub
Sub TestSub
Dim WShell
Set WShell = CreateObject("Wscript.Shel
WShell.Run "cmd.exe /k g:\imagex\xp.bat"
End Sub
Post here a question close request: http:/Community_Support/General/newQuestionWizard.jsp
Oh, too late.
I wonder why I was I not thinking of it? I do it all the time the cmd.exe way!
I wonder why I was I not thinking of it? I do it all the time the cmd.exe way!
Perhaps remove that cleanup:
Set Wshell = Nothing
It will anyway be released.