Skip to content

Commit d958cdc

Browse files
committed
Fixed problem occurring where ffmpeg.exe was in a folder with a space
1 parent a273b72 commit d958cdc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

batch encoder.bat

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ if defined par_updated-from (
160160
)
161161
)
162162
set /p "LOCATION=%icongray% ? %formatend% Where is FFMPEG.exe located? (paste full path): "
163+
set "LOCATION=%LOCATION:"=%"
163164
if not exist "%LOCATION%" (
164165
if not exist "%cd%\%LOCATION%" (
165166
echo.
@@ -173,7 +174,7 @@ if defined par_updated-from (
173174
set "LOC_TEST=%LOCATION:\=%"
174175
set "LOC_TEST=%LOC_TEST:/=%"
175176
if "%LOC_TEST%"=="%LOCATION%" (set "pwsh_prefix=.\")
176-
set "LOCATION_pwsh=%pwsh_prefix%%LOCATION%
177+
set "LOCATION_pwsh=%pwsh_prefix%%LOCATION:"=%
177178
set /a "COUNTER=-1"
178179
for %%f in (.\*) do set /a "COUNTER+=1"
179180
set "TOTAL=%COUNTER%"
@@ -231,7 +232,7 @@ if defined par_updated-from (
231232
rem Move cursor 3 lines up
232233
echo 
233234

234-
%LOCATION% -v quiet -stats -i "%CD%\!INPUTFILE!" -map 0 "%CD%\!OUTPUTFILE!"
235+
"%LOCATION%" -v quiet -stats -i "%CD%\!INPUTFILE!" -map 0 "%CD%\!OUTPUTFILE!"
235236

236237
echo.
237238
echo.
@@ -245,9 +246,9 @@ if defined par_updated-from (
245246
echo.
246247

247248
echo %icongray% ^| %formatend% Checking output file length...
248-
for /F "tokens=*" %%g in ( 'powershell -Command "(%LOCATION_pwsh% -i '!INPUTFILE!' 2>&1 | select-String 'Duration: (.*), s').Matches.Groups[1].Value"'
249+
for /F "tokens=*" %%g in ( 'powershell -Command "(^& '%LOCATION_pwsh%' -i '!INPUTFILE!' 2>&1 | select-String 'Duration: (.*), s').Matches.Groups[1].Value"'
249250
) do (set LEN_INP=%%g)
250-
for /F "tokens=*" %%g in ( 'powershell -Command "(%LOCATION_pwsh% -i '!OUTPUTFILE!' 2>&1 | select-String 'Duration: (.*), s').Matches.Groups[1].Value"'
251+
for /F "tokens=*" %%g in ( 'powershell -Command "(^& '%LOCATION_pwsh%' -i '!OUTPUTFILE!' 2>&1 | select-String 'Duration: (.*), s').Matches.Groups[1].Value"'
251252
) do (set LEN_OUT=%%g)
252253
for /F "tokens=*" %%g in ( 'powershell -Command "[Math]::Abs(((Get-Date !LEN_INP!) - (Get-Date !LEN_OUT!)).TotalSeconds)"'
253254
) do (set LEN_DIFF=%%g)

0 commit comments

Comments
 (0)