Launch a program from command line without opening

2019-01-12 02:50发布

I'm trying to programatically execute a external file from CMD using this comand:

START "filepath"

Where filepath is the path of my file It opens fine but it also open a new command prompt window.

So, which is the right command for opening an external programs without opening a new window?

8条回答
beautiful°
2楼-- · 2019-01-12 02:57

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.

Formatting you command like that also allows you to open more then one program without waiting for the first one to close first.

查看更多
SAY GOODBYE
3楼-- · 2019-01-12 03:03

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"enter image description here

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

start /b "filepath"enter image description here

/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.

查看更多
放我归山
4楼-- · 2019-01-12 03:09

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...

查看更多
祖国的老花朵
5楼-- · 2019-01-12 03:09

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)

查看更多
Rolldiameter
6楼-- · 2019-01-12 03:10

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.

查看更多
地球回转人心会变
7楼-- · 2019-01-12 03:12

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.

查看更多
登录 后发表回答