Saved Bookmarks
| 1. |
Solve : Push commands from a batch file to another open cmd window?? |
|
Answer» HI All, (OS Win XP) 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 BATCH file using echo , but my problem is the cmd window I want to use is created by a vbs. Hmmmm, a quandary. Any advice would be most welcome. Thanks in advancePost the CODE you used?Hi, yes I should have done that, I've kind of gone down the vbs route as I REALISED I needed to objectify the cmd window, but still no joy. First I open a cmd window with:- Dim oShell Set oShell = WScript.CreateObject ("WScript.Shell") oShell.run "adminconsole.svb" 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. I've tried .Exec but this does nort work. oshell.Exec "EMSWrapperInstall.bat" as I guess it's the wrong object. I think this post is now a vbs post so APOLOGIES for it being the wrong placeFound the vbscript solution which runs a script that produces a window:- CreateObject("Wscript.Shell").Run "adminconsole.svb", 0, False Dim oshell Set oshell = CreateObject("WScript.Shell") oshell.Run "cmd.exe" Do Until oshell.AppActivate("Admin C:\WINNT\System32\cmd.exe") Loop oshell.SendKeys "EMSWrapperInstall.bat{enter}" 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!! HURRAH!!! Please feel free to move this thread to vbscript. |
|