How to bring CMD.EXE window to top? (I would prefer a command or script without a need to compile anything).
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.
When you want to go back, type cd - and you will be back where you started.
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With