How to Run Console Programs Without a Console Window
|
by Helge Klein on 08/15/2008 | 1 Comments | 1,206 Views
|
From time to time the question gets asked how a batch file or console program can be executed silently or hidden, i.e. without a console window popping up. If you do not know what I am talking about: press Win+R, type "help" and press ENTER. A black console window will open, execute the HELP command and close again. Often, this is not desired. Instead, the command should execute without any visible window.
Solution 1: For Programmers
Use CreateProcess to execute the command and set the parameter dwCreationFlags to CREATE_NO_WINDOW (0x08000000).
Solution 2: For Script Writers
Use the Run method as illustrated in the following code snippet to execute the command:
Set Shell = CreateObject("WScript.Shell")
Shell.Run """Path to command or batch file""", 0, False
Of the three arguments to Run, the first is the full path to the executable or batch file, the second sets the windows style (0 meaning "hide the window") and the third specifies whether the script waits for the command to return (False meaning "no, do not wait").
Solution 3: For Everybody Else
Use the excellent little free tool hstart. It is not only capable of executing any command without a visible console window but is a full-fledged replacement of the console's START command - and more. For example, it handles Vista UAC elevation and it is even available in a 64-bit version.
- ‹‹‹ previous Article
- 33 of 129
- next Article ›››
[Your opportunity] IT-Competence and work-live-balance is our USP. Continue your career with sepago! Immediate job offers
1 responses for "How to Run Console Programs Without a Console Window" |
Add Comment
![]() |
Helge Klein IT-Architect Blogs about Windows, Terminal Services and other things Personal Profile Personal Blog RSS-Feed ![]() Twitter: HelgeKlein ![]() |
|
Related Jobs
Latest posts
| 07/23/2010 | How to Modify Default Share Permissions and Other Tweaks |
| 07/12/2010 | Will We Use Cloud-Based Virtual Desktops in 2020? |
| 06/21/2010 | Registry Tricks |
Most viewed
| Title | |
|---|---|
| 32,762 Views |
Where is the Hosts File on Windows x64? |
| 27,439 Views |
Deleting a Local User Profile - Not as easy as one Might Assume |
| 19,461 Views |
How to Reduce the Size of Roaming Profiles |





