开发者

Opening another program with start in a .bat file

I've been wracking my brain trying to get this to work. I need to write a bat file that will open a program, wait 15 seconds, then open another program. Here's the code I've come up with...

@echo off
start "program1.exe"
timeout /t 15 >nul /nobreak
start "program2.exe"

The problem is, program1 runs in fullscreen, and needs to start BEFORE program2. When program2 starts, it minimizes program1.

Also, program 1 needs to run in a specific resolution, because of my shitty integrated graphics card. program1 has a shortcut function that i normally use. its just " -vidmode 1280, 720, 60". this starts it in the specific resolution that i need. unfortunately, adding that to the .bat file in the form of the following, does not work.

start "program1.exe -vidmode 1280, 720, 60

or

start "program1.exe -vidmode开发者_如何学Python 1280, 720, 60"

Now then, the only way I can think to fix this problem is to have it start a shortcut, like so...

start "program1 shortcut.lnk"

Unfortunately, that didn't work either.

What can be done to fix this?


What about:

start /MIN "program2.exe"

to start the second program minimized?


None of your code snippets work because of where you placed your quotes - the arguments are treated as part of the program name.

Your first one has an opening quote, but no closing quote. It still treats everything that follows as the name of the program to execute.

The correct syntax is

start "" "program1.exe" -vidmode 1280, 720, 60

The quotes around the program name are really only needed if any part of the actual file name (possibly with path info) contains spaces or special characters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜