How to Run Console Programs Without a Console Window
|
by Helge Klein on 08/15/2008 | 1 Comments | 6,328 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
- 33 of 156
- next ›
+++ Your opportunity +++ Use Profile Migrator 2, the new sepago product that makes migrating user personalities between different platforms a breeze.! Download your free version now!
1 responses for "How to Run Console Programs Without a Console Window" |
Recent Articles
About the author
![]() |
Helge Klein IT-Architect Blogs about Windows, Terminal Services and other things |
Most viewed
| 155,209 Views |
Where is the Hosts File on Windows x64? |
| 83,073 Views |
Deleting a Local User Profile - Not as easy as one Might Assume |
| 53,090 Views |
Printer Driver Isolation in Windows 7 and Server 2008 R2 |








Great! Thank you, first time
Great! Thank you, first time I read about this tool!