How to bring the CMD.EXE window to the beginning

How to transfer CMD.EXE to the beginning? (I would prefer a command or script without having to compile anything).

+5
source share
3 answers

The Wscript.Shell object, accessible from the Windows Script Host (either VBS or JS), has a method called "AppActivate", which, when passing the window title, will try to "activate" (which may bring it to the forefront if it is not minimized).

The following code snippet in VBScript worked on my machine:

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

(Edited: I did not try this initially. Then I did)

+5
source

With compilation:

, Win32 API FindWindow , .

:

, FindWindow SetForgroundWindow, script.

0

You can do AutoHotkey Script:

^SPACE::  Winset, Alwaysontop, , Ahere
Return

Save it as an .ahk file. Run it after you have installed Autohotkey. Now click on the window of your choice and click CTRL+ Space, and the window should always be on top

0
source

All Articles