Windows start hidden window

Process Window Style Перечисление

Определение

Указано, каким образом должно выглядеть новое окно при запуске процесса системой. Specified how a new window should appear when the system starts a process.

Скрытый стиль окна. The hidden window style. Окно может быть видимым или скрытым. A window can be either visible or hidden. Система отображает скрытое окно, не прорисовывая его. The system displays a hidden window by not drawing it. Если окно скрыто, оно эффективно отключено. If a window is hidden, it is effectively disabled. Скрытое окно может обрабатывать сообщения от системы или от других окон, но не может обрабатывать ввод от пользователя или отображать вывод. A hidden window can process messages from the system or from other windows, but it cannot process input from the user or display output. Часто, приложение может держать новое окно скрытым, пока приложение определит внешний вид окна, а затем сделать стиль окна Normal. Frequently, an application may keep a new window hidden while it customizes the window’s appearance, and then make the window style Normal. Чтобы использовать значение Hidden, свойство UseShellExecute должно иметь значение true . To use Hidden, the UseShellExecute property must be true .

Полноэкранный стиль окна. The maximized window style. По умолчанию система расширяет полноэкранное окно, и оно занимает весь экран или, если это дочернее окно, клиентскую область родительского окна. By default, the system enlarges a maximized window so that it fills the screen or, in the case of a child window, the parent window’s client area. Если окно имеет строку заголовка, система автоматически переместит окно наверх экрана или вверху клиентской области родительского окна. If the window has a title bar, the system automatically moves it to the top of the screen or to the top of the parent window’s client area. Также система отключает границу установки размера окна и способность строки заголовка позиционировать окно, так что пользователь не может двигать окно перетаскиванием за строку заголовка. Also, the system disables the window’s sizing border and the window-positioning capability of the title bar so that the user cannot move the window by dragging the title bar.

Минимизированный стиль окна. The minimized window style. По умолчанию система уменьшает минимизированное окно до размеров кнопки панели задач и перемещает его на панель задач. By default, the system reduces a minimized window to the size of its taskbar button and moves the minimized window to the taskbar.

Нормальный, видимый стиль окна. The normal, visible window style. Система отображает окно на экране со стилем Normal в положении по умолчанию. The system displays a window with Normal style on the screen, in a default location. Если окно видимое, пользователь может производить ввод в окно и видеть вывод окна. If a window is visible, the user can supply input to the window and view the window’s output. Часто приложение может инициализировать новое окно стилем Hidden, пока приложение определит внешний вид окна, а затем сделать стиль окна Normal. Frequently, an application may initialize a new window to the Hidden style while it customizes the window’s appearance, and then make the window style Normal.

Читайте также:  Unable to get environment information radmin windows 10

Hide the Console in Batch Files

If we run a batch file by starting it manually, we usually don’t mind seeing the «black square» of the console window.
If, on the other hand, we run a batch file scheduled, or remotely, we often would prefer not to see the «black square» at all.

Several tools and techniques exist to hide a console window.

Start a batch file minimized

The most simple solution is to run the batch file minimized.
The batch file will still be visible in the task bar while running.
For batch file started by a shortcut, this may be «sufficiently hidden».

See this JSIFaq tip on how to make a batch file start another batch file hidden (uses a temporary VBScript file).
Note that, because the script is created and called by a batch file, there will still be a visible console window.

Or download and use my RunNHide.vbs or RunNHide.exe.

Make a batch file minimize its own console

Use one of the following commands within a batch file to minimize that batch file’s console window:

Make a batch file hide its own console

Use one of the following commands within a batch file to hide that batch file’s console window:

Spoiler alert: completely hiding the console is not possible in the standard command interpreters CMD.EXE or COMMAND.COM.
All techniques to hide the console that have to be called from within the batch file will always show at least a short «black flash» of the console being opened before it is hidden.
Therefore, the «cloaking» of the console has to be started before starting the batch file, which means using an alternative scripting language to start the command interpreter hidden.

To restore console visibility, use:

Start a batch file minimized

If a console window is visible already, but you want to start another batch file minimized, use one of the following commands:

Start a batch file hidden

If a console window is visible already, but you want to start another batch file hidden, use one of the following commands:

Run a batch file completely hidden

To completely hide the console, a Windows (GUI) executable or an alternative scripting language with GUI based interpreter (e.g. VBScript with WSCRIPT.EXE) has to be used.
Do not use the following commands in a batch file, as this batch file will run in a (visible) console window itself.

Make sure the batch file closes its own window in all circumstances, because you won’t be able to see whether it does close or keep running «forever».

Bypass UAC, Hide Console Windows, Run Apps in the Background with Hidden Start

Console applications and batch files are regularly run at Windows startup or in a schedule. The main inconvenience of this is that each application opens a console window that flickers on the screen. Hidden Start (or Hstart) is a lightweight command line utility that allows you to run console applications and batch files without any window in the background, handle UAC privilege elevation on Windows 10, 8, 7 and Vista, start multiple commands in the specified order, and much more.

Hstart is a must have if you use batch files on an everyday basis for backups, various file sync and copy scripts, automatic source code compilation or code signing. Read the examples section below to see how it works out and how it can help you.

For your convenience, Hstart comes with a handy GUI tool:

Multiple commands with parameters:

The GUI tool makes it easy to create complex command lines and test them immediately.

Читайте также:  Imovie для mac os high sierra

Examples of Usage

Hstart is usually started by entering the following command line:

It is possible to redirect the console output of batch files into a log file:

The /IDLE command line switch means that the backup process will run with the lowest priority class, and /D=»» sets the starting directory of the batch file (required if the command line or script contain relative paths).

Run Applications without UAC Prompt

The /NOUAC switch allows you to run applications and batch files with administrative privileges without any UAC prompts. Here is a simple example:

Of course, it can be used with other options:

The following command opens Local Group Policy Editor:

And here is how to open Windows Hosts file for editing:

Environment Variables

As you can see from the previous example, Hstart 4.0 expands environment variables in the executed command lines. This may help you to make more system independent commands:

For more information, see tutorials and browse the «examples» folder.

How can I run a windows batch file but hide the command window?

How can I run a windows batch file but hiding the command window? I dont want cmd.exe to be visible on screen when the file is being executed. Is this possible?

10 Answers 10

If you write an unmanaged program and use CreateProcess API then you should initialize lpStartupInfo parameter of the type STARTUPINFO so that wShowWindow field of the struct is SW_HIDE and not forget to use STARTF_USESHOWWINDOW flag in the dwFlags field of STARTUPINFO. Another method is to use CREATE_NO_WINDOW flag of dwCreationFlags parameter. The same trick work also with ShellExecute and ShellExecuteEx functions.

If you write a managed application you should follows advices from http://blogs.msdn.com/b/jmstall/archive/2006/09/28/createnowindow.aspx: initialize ProcessStartInfo with CreateNoWindow = true and UseShellExecute = false and then use as a parameter of . Exactly like in case of you can set property WindowStyle of ProcessStartInfo to ProcessWindowStyle.Hidden instead or together with CreateNoWindow = true .

You can use a VBS script which you start with wcsript.exe. Inside the script you can use CreateObject(«WScript.Shell») and then Run with 0 as the second ( intWindowStyle ) parameter. See http://www.robvanderwoude.com/files/runnhide_vbs.txt as an example. I can continue with Kix, PowerShell and so on.

If you don’t want to write any program you can use any existing utility like CMDOW /RUN /HID «c:\SomeDir\MyBatch.cmd», hstart /NOWINDOW /D=c:\scripts «c:\scripts\mybatch.bat», hstart /NOCONSOLE «batch_file_1.bat» which do exactly the same. I am sure that you will find much more such kind of free utilities.

In some scenario (for example starting from UNC path) it is important to set also a working directory to some local path ( %SystemRoot%\system32 work always). This can be important for usage any from above listed variants of starting hidden batch.

Run a program hidden in Windows 10

Do you know that you can start an application hidden in Windows? Sometimes you need to because some apps can run in the background doing their task without interrupting your workflow. You might want to run an app hidden from a batch script, let it do its work and not show any window. In this article, we will see all ways to run a program hidden in Windows 10.

In the article, we will hide Notepad as an example. You can use the same method to hide any other app you want.

Method 1. Using VBScript

This is the old and «traditional» way to start apps hidden. It works in every Windows version where VBScript is available. All modern Windows versions have VBScript support.

Open your favorite text editor and paste the following text.

Читайте также:  Event properties in windows

Save it to a file with the .VBS extension. When you double click it, it will start Notepad hidden.

To call it from a batch file, execute it as follows:

Here, the Run method of the Wscript.Shell object runs a program in a new process. The second parameter is 0, which tells it to run the application hidden.
If you need to run an application with some command line arguments, the syntax is as follows:

If the application path contains spaces, add quotes to the beginning and to the end of the path. For example:

You can verify that the app is running by opening Task Manager. You will see Notepad.exe running but no window will be shown for it.

Method 2. Using PowerShell

PowerShell in Windows 10 and earlier versions comes with a built-in cmdlet Start-Process which can be used to start programs hidden too.
The syntax is as follows:

If you save this text in a file with a .PS1 extension, then you can call it from a batch file as follows:

Method 3. Using a third party tool

There are a number of third party tools which can use to manipulate window states. The only problem with such third party tools is that they often trigger false positives in antivirus software. If you need to use a third party tool, I suggest you to play with these:
Quiet

The syntax is as follows:

NirCmd by NirSoft
NirCmd is a powerful console tool which can do a lot of useful tricks. One of its options is the ability to start a process hidden.
The syntax is as follows:

That’s it. If you use some alternative way to start an app hidden in Windows 10, feel free to share it in the comments.

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

Share this post

About Sergey Tkachenko

Sergey Tkachenko is a software developer from Russia who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

15 thoughts on “ Run a program hidden in Windows 10 ”

Really great for fork bombing a friend.

hahaha. very nice idea.

This works with Notepad, but it can’t find any files elsewhere. I put in proper path with quotations. Nothing doing. Have you tried running it with other installed applications?

Sure I tried.
Can you post your script here?

Just replace notepad with any other program that has an actual path. Like “C:\Program Files (x86)\VSO\ConvertX\6\ConvertXtoDvd.exe”. I run the script and it says it can’t find it. I run VBS every day. I even put it on root drive. Not that I want to run above invisibly, but I was just trying it out.

I figured out what is the problem.
If path contains spaces, like in your case in “Program Files”, you need to use extra quotes in the Run method arguments. See this image:

Added this to the article.

Who fixed a lots of bugs on win10 anniversary update?
Bill Gates?

They have a huge number of developers.
But not Bill Gates 🙂

thanks for the reply

🙁 doesn`t work on wind 10 🙁 need for one game to hide HxD.exe
app start after using cmd, PowerShell but I can see it in in task manager
fu.. why hidetoolz doesn`t work on new windows? 🙁

this is because your app is relaunches itself with a new instance quickly, so it appears visible.
#notabug

Оцените статью