Monday, August 16, 2010

How can you close a window with Command Prompt?

I searched for this and just kept getting links to how to close the command prompt window. That's not what i want. How do you close a window you have open with CMD? like say i want to close this internet window (firefox) with CMD. How would i go about doing that?How can you close a window with Command Prompt?
Taskkill /f /im firefox.exeHow can you close a window with Command Prompt?
http://lmgtfy.com/?q=how+to+close+window鈥?/a>
taskkill (yes, with 2 k's) will let you kill a process from the command line. This is what I think you want.
Set WshShell = CreateObject(';Wscript.Shell';)


WshShell.SendKeys ';{ALT}{SPACEBARE}C}';


WScript.Echo ';Active App Is Now Closed!';





I am not sure about the command that you would use for sendkeys but you can look here for reference :





http://www.ss64.com/wsh/sendkeys.html





You should be able to script Alt + F4 to close the window, just don't forget to use the % when you script Alt as a combination key.

No comments:

Post a Comment