Run Console Applications & Batch Files, without any Window, in the background

Many times systems engineers come across the need to suppress the console window of a cmd prompt while setting up various batch and script automations to be run in silent mode.

Below is the list of various options available to control the cmd console window and you need to choose the option as per your requirements:

  1.  Hidden Start (a complete solution to control console windows and also supports x64bit)
  2.  Start (helps control spawned process console)
  3.  PowerShell –WindowStyle Hidden
  4.  WshShell.Run WindowStyle = 0
  5.  Javaw.exe is a console/window less Java.exe that runs Java programs as hidden process

Hidden Start v3.2  (64-bit)
Run from command line:



/NOCONSOLE – start console applications without any windows

/ELEVATED or /RUNAS – start applications in elevated mode (Vista)

/NONELEVATED – start applications in non-elevated mode (Vista)

/UAC – run Hstart executable in elevated mode (Vista)

/SHELL – run apps, open docs and URLs in the Windows Shell

/D=PATH – set the starting directory for executed applications

/DELAY=N – delay N seconds before command execution

/WAIT – wait for the application to terminate (run synchronously)

/WAITINPUT – wait for the user input to set the priority class

/MSG=TEXT – show the message after command execution

/TITLE=TEXT – set the title of the message

/ERRMSG=TEXT – show the error message if an error detected

/ERRTITLE=TEXT – set the title of the error message

/SILENT – silent mode, no error messages will be displayed

/TEST – test mode, see what parameters are passed to Hstart

PRIORITY classes:


Don’t forget about quotes when using complex COMMAND LINES:

hstart64.exe /NOCONSOLE /D="C:Dir 1"  ""C:Dir 2test.bat" -param"




C:>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program]

    "title"     Title to display in window title bar.
    path        Starting directory.
    B           Start application without creating a new window. The
                application has ^C handling ignored. Unless the application
                enables ^C processing, ^Break is the only way to interrupt
                the application.
    I           The new environment will be the original environment passed
                to the cmd.exe and not the current environment.
    MIN         Start window minimized.
    MAX         Start window maximized.
    SEPARATE    Start 16-bit Windows program in separate memory space.
    SHARED      Start 16-bit Windows program in shared memory space.
    LOW         Start application in the IDLE priority class.
    NORMAL      Start application in the NORMAL priority class.
    HIGH        Start application in the HIGH priority class.
    REALTIME    Start application in the REALTIME priority class.
    ABOVENORMAL Start application in the ABOVENORMAL priority class.
    BELOWNORMAL Start application in the BELOWNORMAL priority class.
    AFFINITY    The new application will have the specified processor
                affinity mask, expressed as a hexadecimal number.
    WAIT        Start application and wait for it to terminate.
                If it is an internal cmd command or a batch file then
                the command processor is run with the /K switch to cmd.exe. This means that the window will remain after the command
                has been run.

                If it is not an internal cmd command or batch file then
                it is a program and will run as either a windowed application or a console application.

    parameters  These are the parameters passed to the command/program.

NOTE: The SEPARATE and SHARED options are not supported on 64-bit platforms.

If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:

non-executable files may be invoked through their file association just
    by typing the name of the file as a command.  (e.g.  WORD.DOC would
    launch the application associated with the .DOC file extension).
    See the ASSOC and FTYPE commands for how to create these
    associations from within a command script.

When executing an application that is a 32-bit GUI application, CMD.EXE
    does not wait for the application to terminate before returning to
    the command prompt.  This new behavior does NOT occur if executing
    within a command script.

When executing a command line whose first token is the string "CMD "
    without an extension or path qualifier, then "CMD" is replaced with
    the value of the COMSPEC variable.  This prevents picking up CMD.EXE
    from the current directory.

When executing a command line whose first token does NOT contain an
    extension, then CMD.EXE uses the value of the PATHEXT
    environment variable to determine which extensions to look for
    and in what order.  The default value for the PATHEXT variable


    Notice the syntax is the same as the PATH variable, with
    semicolons separating the different elements.

When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name.  If it does, the
START command launches the Explorer on that path.  If done from the
command line, it is the equivalent to doing a CD /D to that path.





C:>powershell /?

PowerShell[.exe] [-PSConsoleFile <file> | -Version <version>]
    [-NoLogo] [-NoExit] [-Sta] [-NoProfile] [-NonInteractive]
    [-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
    [-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>]
    [-File <filePath> <args>] [-ExecutionPolicy <ExecutionPolicy>]
    [-Command { – | <script-block> [-args <arg-array>]
                  | <string> [<CommandParameters>] } ]

PowerShell[.exe] -Help | -? | /?

    Loads the specified Windows PowerShell console file. To create a console
    file, use Export-Console in Windows PowerShell.

    Starts the specified version of Windows PowerShell.

    Hides the copyright banner at startup.

    Does not exit after running startup commands.

    Start the shell using a single-threaded apartment.

    Does not use the user profile.

    Does not present an interactive prompt to the user.

    Describes the format of data sent to Windows PowerShell. Valid values are
    "Text" (text strings) or "XML" (serialized CLIXML format).

    Determines how output from Windows PowerShell is formatted. Valid values
    are "Text" (text strings) or "XML" (serialized CLIXML format).

    Sets the window style to Normal, Minimized, Maximized or Hidden.

    Accepts a base-64-encoded string version of a command. Use this parameter
    to submit commands to Windows PowerShell that require complex quotation
    marks or curly braces.

    Execute a script file.

    Sets the default execution policy for the session.

    Executes the specified commands (and any parameters) as though they were
    typed at the Windows PowerShell command prompt, and then exits, unless
    NoExit is specified. The value of Command can be "-", a string. or a
    script block.

    If the value of Command is "-", the command text is read from standard

    If the value of Command is a script block, the script block must be enclosed
    in braces ({}). You can specify a script block only when running PowerShell.exe
    in Windows PowerShell. The results of the script block are returned to the
    parent shell as deserialized XML objects, not live objects.

    If the value of Command is a string, Command must be the last parameter
    in the command , because any characters typed after the command are
    interpreted as the command arguments.

    To write a string that runs a Windows PowerShell command, use the format:
quot;& {<command>}"
    where the quotation marks indicate a string and the invoke operator (&)
    causes the command to be executed.

-Help, -?, /?
    Shows this message. If you are typing a PowerShell.exe command in Windows
    PowerShell, prepend the command parameters with a hyphen (-), not a forward
    slash (/). You can use either a hyphen or forward slash in Cmd.exe.

    PowerShell -PSConsoleFile SqlSnapIn.Psc1
    PowerShell -version 1.0 -NoLogo -InputFormat text -OutputFormat XML
    PowerShell -Command {Get-EventLog -LogName security}
    PowerShell -Command "& {Get-EventLog -LogName security}"

    # To use the -EncodedCommand parameter:
    $command = ‘dir "c:program files" ‘
    $bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
    $encodedCommand = [Convert]::ToBase64String($bytes)
    powershell.exe -encodedCommand $encodedCommand




C:>type InvokeHiddenProcess.vbs

Set WshShell = WScript.CreateObject("WScript.Shell")
cmd = "cmd /k Test.bat"
Return = WshShell.Run(cmd, 0, True)
set WshShell = Nothing


C:>type Test.bat
echo "helloo" > testing.txt

C:>type testing.txt




    javaw [ options ] class [ argument … ]
    javaw [ options ] -jar file.jar [ argument … ]

       Command-line options.
       Name of the class to be invoked.
       Name of the jar file to be invoked. Used only with -jar.
       Argument passed to the main function.

For more detailed arguments list refer to Sun Java’s Javaw – the Java application launcher.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.