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

前端 未结 9 828
走了就别回头了
走了就别回头了 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:50

    I think if you closed a program

    taskkill /f /im "winamp.exe" 
    //....(winamp.exe is example)...
    

    end, so if you want to start a program that you can use

    start "" /normal winamp.exe 
    

    (/norma,/max/min are that process value cpu)

    ALSO

    start "filepath"

    if you want command line without openning an new window you write that

    start /b "filepath"

    /B is 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:53

    If you're doing it via CMD as you say, then you can just enter the command like so:

    path\to\your.exe 
    

    which will open it within the same window. For example in C++:

    system("path\\to\\your.exe"); // Double backslash for escaping
    

    will open your.exe in the current CMD window. Likewise to start with a new window, just go for:

    system("start path\\to\\your.exe");
    

    If you go for the first option, you would have to clear your screen unless you wanted to have the command to open your.exe on the screen still.

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

    Just remove the double quote, this works in Windows 7:

    start C:\ProgramFiles\folderName\app.exe
    

    If you want to maximize the window, try this:

    start /MAX C:\ProgramFiles\folderName\app.exe
    


    Your command START "filepath" will start a command prompt and change the command prompt title to filepath.

    Try to run start /? in windows command prompt and you will get more info.

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