我可以在 Windows 命令行的后台运行 GUI 程序吗?

Jas*_*ker 16 windows command-line-interface

例如,在 Bash 中,我可以这样做:

emacs foo.txt &
Run Code Online (Sandbox Code Playgroud)

Windows 中是否有任何等价物?我似乎无法找到一种使用 Windows 版本的 emacs 来做到这一点的方法。

Kev*_*hal 22

在 Windows 中从命令行启动程序的命令是“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
Run Code Online (Sandbox Code Playgroud)

您可能希望使用 MIN 选项来启动最小化的程序

  • 仅供参考,在这种情况下,正确的命令是“start /B emacs foo.txt”。否则,它会在自己的控制台窗口中运行,这是可以接受的,但很烦人。:-) (2认同)