1.

Solve : Push commands from a batch file to another open cmd window??

Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/hi-479908" style="font-weight:bold;" target="_blank" title="Click to know more about HI">HI</a> All,<br/><br/>(OS Win XP)<br/><br/>This might sound a little outlandish, but I wondered if it was possible.  I have googled it to death so I guess this is not the case.  You lovely people might prove me wrong!!   I can push commands to another <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a> file using echo , but my problem is the cmd window I want to use is created by a vbs.  <br/><br/>Hmmmm, a quandary.<br/><br/>Any advice would be most welcome.<br/><br/>Thanks in advancePost  the <a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a> you used?Hi, yes I should have done that, I've kind of gone down the vbs route as I <a href="https://interviewquestions.tuteehub.com/tag/realised-2977718" style="font-weight:bold;" target="_blank" title="Click to know more about REALISED">REALISED</a> I needed to objectify the cmd window, but still no joy.<br/><br/>First I open a cmd window with:-<br/><br/>Dim oShell<br/>Set oShell = WScript.CreateObject ("WScript.Shell")<br/>oShell.run "adminconsole.svb"<br/><br/>The adminconsole.svb routine opens a cmd window and this is the one I want to use to push commands into onto the command line.<br/><br/>I've tried .Exec but this does nort work.<br/>oshell.Exec "EMSWrapperInstall.bat" as I guess it's the wrong object.<br/><br/>I think this post is now a vbs post so <a href="https://interviewquestions.tuteehub.com/tag/apologies-881823" style="font-weight:bold;" target="_blank" title="Click to know more about APOLOGIES">APOLOGIES</a> for it being the wrong placeFound the vbscript solution which runs a script that produces a window:-<br/><br/>CreateObject("Wscript.Shell").Run "adminconsole.svb", 0, False<br/><br/>Dim oshell<br/>Set oshell = CreateObject("WScript.Shell")<br/>oshell.Run "cmd.exe"<br/><br/>Do Until oshell.AppActivate("Admin C:\WINNT\System32\cmd.exe")<br/>Loop<br/><br/>oshell.SendKeys "EMSWrapperInstall.bat{enter}"   <br/><br/>The Do Until finds the one you want via the title bar, so a distinctive title bar is required in your cmd session that is created from the adminconsole.svb.  Then I can sendkeys to that cmd box!!<br/><br/>HURRAH!!!    <br/><br/>Please feel free to move this thread to vbscript.</body></html>


Discussion

No Comment Found