N
N
nallion2016-02-09 19:02:21
cmd/bat
nallion, 2016-02-09 19:02:21

How to write a bat file (need a little logic)?

Good afternoon!
You need to write a bat file that changes the screen resolution on startup, launches a console program
And after closing the program, it returns the screen resolution back
What we have:
"C:\Program Files (x86)\MultiRes\MultiRes.exe" /1:1280,720,32
start ffmpeg.exe -f dshow -i video="screen-capture-recorder" -vb 5000k %DATE%-%time:~0.2%.%time:~3.2%.avi
"C:\Program Files (x86)\MultiRes\MultiRes.exe" /restore
you need the last line ("C:\Program Files (x86)\MultiRes\MultiRes.exe" /restore) to work only after closing the console with ffmpeg (second line)
as do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
Zolg, 2016-02-09
@Zolg

remove start from the beginning of the second line or use start /wait

S
Saboteur, 2016-02-09
@saboteur_kiev

It's easier for you then not to close the ffmpeg console, but to write a separate batch file for this.
start_ffmpeg.bat:

"C:\Program Files (x86)\MultiRes\MultiRes.exe" /1:1280,720,32
ffmpeg.exe -f dshow -i video="screen-capture-recorder" -vb 5000k %DATE%-%time:~0,2%.%time:~3,2%.avi

Close_ffmpeg.bat:
TASKKILL FFMPEG
"C:\Program Files (x86)\MultiRes\MultiRes.exe" /restore

And run it whenever you want to kill ffmpeg

N
nallion, 2016-02-09
@nallion

I found someone else's solution and adapted it for myself

"C:\Program Files (x86)\MultiRes\MultiRes.exe" /1:1280,720,32
@ECHO OFF
TASKKILL FFMPEG
START "" C:\Users\nallion\Desktop\Record\ffmpeg.exe -f dshow - i video="screen-capture-recorder" -vb 5000k C:\Users\nallion\Desktop\Record\%DATE%-%time:~0.2%.%time:~3.2%.avi
:LOOP
tasklist | find /i "FFMPEG" >nul 2>&1
IF ERRORLEVEL 1 (
GOTO CONTINUE
) ELSE (
Timeout /T 5 /Nobreak
GOTO LOOP
)
:CONTINUE
"C:\Program Files (x86)\MultiRes\MultiRes.exe" /restore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question