How do I launch a program from command line without opening a new cmd window?

前端 未结 9 827
走了就别回头了
走了就别回头了 2020-12-01 16:00

I\'m trying to programmatically execute an external file from cmd using this command:

START \"filepath\"

Where \"filepat

相关标签:
9条回答
  • 2020-12-01 16:28

    You can use the call command...

    Type: call /?

    Usage: call [drive:][path]filename [batch-parameters]

    For example call "Example File/Input File/My Program.bat" [This is also capable with calling files that have a .exe, .cmd, .txt, etc.

    NOTE: THIS COMMAND DOES NOT ALWAYS WORK!!!

    Not all computers are capable to run this command, but if it does work than it is very useful, and you won't have to open a brand new window...

    0 讨论(0)
  • 2020-12-01 16:29

    In Windows 7+ the first quotations will be the title to the cmd window to open the program:

    start "title" "C:\path\program.exe"
    

    Formatting your command like the above will temporarily open a cmd window that goes away as fast as it comes up so you really never see it. It also allows you to open more than one program without waiting for the first one to close first.

    0 讨论(0)
  • 2020-12-01 16:33

    I got it working from qkzhu but instead of using MAX change it to MIN and window will close super fast.

    @echo off
    cd "C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin"
    :: Title not needed:
    start /MIN  mysqld.exe
    exit
    
    0 讨论(0)
  • 2020-12-01 16:36

    Add /B, as documented in the command-line help for start:

    C:\>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]
      [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/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.
    
    0 讨论(0)
  • 2020-12-01 16:41

    1-Open you folder that contains your application in the File Explorer. 2-Press SHIFT and Right Click in White Space. 3-Click on "Open command window here". 4-Run your application. (you can type some of the first characters of application name and press Up Arrow Key OR Down Arrow Key)

    0 讨论(0)
  • 2020-12-01 16:49

    20190907

    OS: Win 10

    I'm making an exe in c++, for some reason usting START make my program fail.

    So, just use quotes:

    "c:\folder\program.exe"

    0 讨论(0)
提交回复
热议问题