cmd - Windows batch script with multiple commands -


ok, have windows 10 .bat script convert type videos in 1 folder , output in using handbrakecli multiple commands.

in addition that, want use cpu usage limiter bes control cpu usage of handbrakecli.

after each file converted, want send pushbullet notification myself stating conversion complete.

the code below helps me achieve that, need run .bat file twice make start , after 1 iteration stops.

initially had problems using multiple commands , did search , used "&" between commands, no joy.

i have powershell script this, please don't suggest powershell, don't want use because powershell script requires elevated privileges don't want give anymore.

for /r "d:\toconvert" %%i in (*.*) "c:\program files (x86)\bes_1.6.2\bes.exe" "c:\program files\handbrake\handbrakecli.exe" 33 --minimize & "c:\program files\handbrake\handbrakecli.exe" -i "%%i" -t 1 -c 1 -o "d:\done\%%~ni.mp4" --preset="normal" --optimize & powershell -executionpolicy bypass -command "d:\scripts\sendpushbullet.ps1 "%%~ni" " converted"" & taskkill /im bes.exe 

or

call "c:\program files (x86)\bes_1.6.2\bes.exe" "c:\program files\handbrake\handbrakecli.exe" 33 --minimize /r "d:\toconvert" %%i in (*) ( "c:\program files\handbrake\handbrakecli.exe" -i "%%i" -o "d:\done\%%~ni.mp4" --preset="normal" --optimize powershell -executionpolicy bypass -command "d:\scripts\sendpushbullet.ps1 "%%~ni" " converted"" ) taskkill /im bes.exe exit /b 

//todo

delete converted file

update: got work using code below want delete converted file "toconvert" folder each loop

start "" "c:\program files (x86)\bes_1.6.2\bes.exe" "c:\program files\handbrake\handbrakecli.exe" 33 --minimize /r "d:\toconvert" %%i in (*) ( "c:\program files\handbrake\handbrakecli.exe" -i "%%i" -o "d:\done\%%~ni.mp4" --preset="normal" --optimize powershell -executionpolicy bypass -command "d:\scripts\sendpushbullet.ps1 "%%~ni" " converted"" ) taskkill /im bes.exe 

to delete original file toconvert, can add del "%%i" @ end of loop. indeed, %%i holds absolute path file.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -