Can I run a GUI program in the background on the windows command-line?

Solution 1:

The command to launch programs from the command-line in Windows is "start"

Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program]
      [parameters]

    "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

You may want to use the MIN option to start a program minimized

Solution 2:

I don't know if it will be sufficient, but try

start emacs foo.txt

It will not go into background but it will rather start separate cmd.exe window for the command.


Solution 3:

HaHa,I successed ,To use sublime text3 as a server of markdown preview is my propose,after I closed sublime text's window,i won't work. I'd try many methods,at last it works. first,you should create a bat to start this program.

start  /B "" "D:\dev\sublime3\Sublime Text 3\subl.exe" "-s" "%USERPROFILE%\Dropbox\dev\apis\*.markdown" 

sencond,run this bat by schedule task.

run window+R->taskschd.msc->add a task

add a trigger to run this bat according this schedule

add this bat as a operation to execute

This result is that it works to avoid to show sublime text window.and it work conflict with sublime text normally opened.

Maybe you had guessed ,I use OmniMarkupPreviewer plugin to preview markdown.I had fixed this bug(or not perfect feature) that it uses different view id every time.