|
Answer» Hi All,
I have a DOS BATCH file which will be EXECUTED for a while. During it is running, other Windows may get the focus and my DOS window may lose the focus. My question is: how can my DOS windows which is runing by my batch file be able to re-gain the focus or to be activated again by my batch file? Are there any specific DOS command executed in my batch file can make this happens?
Thanks in advance.
Jim If you are running Windows 2000 / XP / 2003 / Vista, you can do something like this: Code: [Select]echo set WshShell = CreateObject("WScript.Shell") > cmdFocus.vbs echo WshShell.AppActivate "Command Prompt - %0" >> cmdFocus.vbs start cscript cmdFocus.vbs del cmdFocus.vbs You will need write access to the current directory for this to work. I don't know of any ways to do this in pure batch, so what this does is create a small VBS file that switches focus, runs the script and deletes the temporary script. Will this work? It works!!! Thanks a lot.
Jim Good. Glad to help.
|