Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bring a CMD.EXE window to top

Tags:

cmd

How to bring CMD.EXE window to top? (I would prefer a command or script without a need to compile anything).

like image 838
agsamek Avatar asked Apr 24 '09 15:04

agsamek


People also ask

How do I elevate Command Prompt EXE?

Click Start menu, type cmd, right-click the Command Prompt application and choose Run as Administrator. When the User Account Control window appears, click Yes to launch the elevated cmd.exe.

How do I go back to upper folder in cmd?

When you want to go back, type cd - and you will be back where you started.

How do I bring up the command line?

Open Command Prompt from the Run BoxPress Windows+R to open “Run” box. Type “cmd” and then click “OK” to open a regular Command Prompt. Type “cmd” and then press Ctrl+Shift+Enter to open an administrator Command Prompt.


1 Answers

The Wscript.Shell object accessible from Windows Script Host (either VBS or JS) has a method called "AppActivate" which, when passed a window title, will attempt to "activate" (which may bring it to the foreground if it's not minimised).

The following code snippet in VBScript worked on my machine:

Set WShell = CreateObject("WScript.Shell")
WShell.AppActivate "Command Prompt"

(Edited: Initially I hadn't tried it. Then I did)

like image 66
Jason Musgrove Avatar answered Oct 23 '22 05:10

Jason Musgrove