Hidden Start - run apps in the background

Console applications and batch scripts are regularly run at Windows startup and in schedule. The main inconvenience of this is that every application creates a new console window which flickers on the screen. Hidden Start (or Hstart) is a small startup manager that allows console applications to be started without any windows in the background and much more. Hstart is usually started by entering the following command line:

hstart /NOCONSOLE "batch_file_1.bat" "batch_file_2.bat" "batch_file_3.bat"

Hstart is very effective if you are using console utilities for everyday tasks: daily backups, automatic source code compilation and code signing. Please read the examples section below to see how it works out.

Hidden Start - Help

Hstart is very small (~12 Kb), but it allows you to:

  • start multiple applications in the specified order synchronously;
  • start console applications without any windows in the background;
  • set the working directory and priority class of the created processes;
  • handle UAC privilege elevation under Windows Vista;
  • show simple messages after command execution.

Using Hstart, it is also possible to run batch files in the background and save console output into a log file:

hstart /NOCONSOLE /IDLE /D="E:\Backups\"
       "cmd.exe /c "E:\Backups\backup.bat > backup-log.txt""

It is very effective if you are using console utilities for daily backups. The command line switch /IDLE means that the backup process will run with the lowest priority class, and /D="" sets the starting directory of the batch file (necessary if it uses relative paths).

What is new in Hstart v2.0

Hstart v2.0 contains a number of innovative features that enable even easier working methods. Please read this carefully before using the new version.

User-friendly quote processing

Hstart v2.0 uses its own algorithm to parse complex command line arguments. It enumerates all the opening/closing quotation marks and handles embedded quotes in a more user-friendly manner. Double-quoting is the way that you have to escape a single embedded quotation mark.

Important note for existing users

If you are moving from an old version of Hstart to version 2.0, you have to recheck and possibly rewrite all your Hstart command lines. The following command line switches may help you to move quickly:

  • /TEST - enable the "test mode" to see what parameters are passed to Hstart and how they are processed;
  • /NQ - use the old algorithm to parse command line arguments, provided by CommandLineToArgvW function (it is highly NOT recommended).

Here is how it works out:

hstart /TEST "cmd.exe /k "echo "a phrase" "" with spaces "" eof""

Compare with the old algorithm:

hstart /NQ /TEST "cmd.exe /k \"echo \"a phrase\" \" with spaces \" eof\""

This will execute cmd.exe with the following parameters:

cmd.exe /k "echo "a phrase" " with spaces " eof"

And you will see: "a phrase" " with spaces " eof

Test mode

The /TEST command line switch allows you to see what parameters are passed to Hstart and how they are processed:

hstart /TEST "notepad "C:\Windows\System32\drivers\etc\hosts""

You will be prompted with an information message before executing any commands:

Hidden Start - Test Mode

It is highly recommended to check all command lines with the /TEST switch before using Hstart in a real-world environment.

Message after command execution

Hstart allows you to run console applications completely hidden, and now there is a simple way to tell the user whether the command is executed correctly or not:

hstart /WAIT /MSG="Your command executed successfully."
       /TITLE="Congratulations!!!" "Success.exe -parameters"

This will bring up the following message after command execution:

Hidden Start - Success Message

Here is how to set up an error message:

hstart /WAIT /ERRMSG="An error occurred while processing your request."
       /ERRTITLE="Unknown Error" "Failure.exe -parameters"

The error message will be displayed only if the executed command failed:

Hidden Start - Error Message

Note that the /WAIT switch is required to determine the return code of the executed command. For a real-life example, please see Example 3: Code Signing with one click.

Run applications from the Windows Shell

Essentially, the new /SHELL command line switch works in the same way as the Windows Run dialog: the given parameters are passed to the Windows Shell to be handled rather than by calling the application directly. This makes it possible for the Shell to select an appropriate program to run for a given filename.

Hidden Start - Run Dialog

The /SHELL command line switch is also required when running elevated and UIAccess applications under Windows Vista.

UAC privilege elevation under Windows Vista

Especially for Windows Vista users, Hstart v2.0 provides two new command line switches: /RUNAS and /UAC. The first switch is equal to the "Run as administrator" Shell command:

hstart /RUNAS "notepad.exe" "cmd.exe" "inputdoc.exe"

After running this command line, you will see three UAC confirmation dialogs: first for Notepad, second for Command Prompt and third for an unsigned application (inputdoc.exe). Here is the third UAC dialog:

Unidentified Application - UAC Confirmation Dialog

Compare with the following command line:

hstart /UAC "notepad.exe" "cmd.exe" "inputdoc.exe"

In this case, you will see only one UAC confirmation dialog asking you to run Hstart executable with administrative privileges:

Hidden Start - UAC Confirmation Dialog

Hstart executable is digitally signed, so it can be used to launch other unsigned applications at Windows startup without being blocked by UAC.

Also it is possible to run batch files in the background with administrative privileges:

hstart /RUNAS /NOCONSOLE "D:\Batch Files\Requires_Admin_Privileges.bat"

Hstart is only a 14 KB download.

Examples of Usage

Here are a few real-world examples of using Hstart:

More examples coming soon... Please visit our support forums to report any bugs and suggest new features.

Download

Hstart executable, readme and examples:

Download - hstart.zip (23 KB)

If you wish to distribute any component of Hstart as part of your software product, please read Commercial Licensing and Distribution Requirements.


Version History

  • May 6, 2008 - Hstart 64-Bit Edition (AMD64/EM64T)
  • April 18, 2008 - Added /SILENT switch, error if the parameter is unknown
  • March 14, 2008 - Version 2.0 with a couple of new features
  • February 2, 2007 - Added /WAIT and /HELP switches
  • January 9, 2006 - First public release
  • March 8, 2003 - First private release

* All screenshots on this page are made with WinSnap.