I'd like to start a console app upon startup, but I'd like it not to clutter the taskbar with a cmd.exe item. The options I have when editing a shortcut are only "Normal window", "Minimized", and "Maximized". I faintly remember some Windows version having "Hidden" as an option. I'm using Windows 2008.
3 Answers
I've had this problem too, I wrote a small app that does this: http://miffthefox.googlepages.com/silentcmd.
-
-
Here is another implementation if you care about text output of hidden console app.– AlexMay 13, 2019 at 12:40
You can create a .vbs file with the following
Const HIDDEN_WINDOW = 12 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_ objConfig.ShowWindow = HIDDEN_WINDOW Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process") errReturn = objProcess.Create("Cmd.exe /c C:\run.bat", null, objConfig, intProcessID)
And replace
"Cmd.exe /c C:\run.bat"with your silent command
-
1Wow, that is a lot of work for what the WScript.Shell object already exposes with it's .Run method.– EBGreenAug 25, 2009 at 21:09
-
Didn't work. It starts and ends, doesn't print any message when I run it from a command prompt. What I'm trying to run is the Folding@Home client, fah6.exe. I don't want to run it as a service.– JCCyCAug 26, 2009 at 22:00
According to this page from the MSDN setting intWindowStyle
(one of the arguments to WScript.Shell.Run) to 0
Hides the window and activates another window.
Though it also states:
intWindowStyle
Optional. Integer value indicating the appearance of the program's window. Note that not all programs make use of this information.