Skip to content

Commit 4483aa5

Browse files
committed
Correctly escaping arguments
1 parent beb1083 commit 4483aa5

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

batch encoder.bat

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pause rem remove
4949

5050
:AskProceed
5151
call:ClearAndTitle
52-
if %par_silent%==true (goto AskUpdate)
52+
if "%par_silent%"=="true" (goto AskUpdate)
5353
echo %icongray% i %formatend% This program will aim to encode all .mp4 files in the folder it's placed in and delete the originals.
5454
set /p "startconfirmation=Do you want to proceed? %textgray%[Y/N]%formatend%: "
5555
if /i "%startconfirmation%"=="n" exit
@@ -58,10 +58,11 @@ pause rem remove
5858

5959
:AskUpdate
6060
call:ClearAndTitle
61-
if /i %par_silent%==true (
61+
if /i "%par_silent%"=="true" (
6262
if not defined par_update (echo Error: --silent switch used but --update [true/false] not provided. & exit /b 1)
63-
if /i "%par_update:"=%"=="false" (goto FFMPEGLocation)
64-
if /i "%par_update:"=%"=="true" (goto AutoUpdate)
63+
set "par_update=%par_update:"=%"
64+
if /i "%par_update%"=="false" (goto FFMPEGLocation)
65+
if /i "%par_update%"=="true" (goto AutoUpdate)
6566
echo Error: --update argument invalid ^(should be [true/false]^). & exit /b 1
6667
)
6768
set /p "updateconfirmation=%icongray% ^ %formatend% Would you like to check for an update? %textgray%[Y/N]%formatend%: "
@@ -113,12 +114,13 @@ pause rem remove
113114

114115
:FFMPEGLocation
115116
call:ClearAndTitle
116-
if /i %par_silent%==true (
117+
if /i "%par_silent%"=="true" (
117118
if not defined par_ffmpegloc (echo Error: --silent switch used but --ffmpegloc [path] not provided. & exit /b 1)
118-
if not exist "%par_ffmpegloc:"=%" (
119+
set "par_ffmpegloc=%par_ffmpegloc:"=%"
120+
if not exist "%par_ffmpegloc%" (
119121
echo "Error: --ffmpegloc path provided does not exist." & exit /b 1
120122
) else (
121-
set "LOCATION=%par_ffmpegloc:"=%"
123+
set "LOCATION=%par_ffmpegloc%"
122124
goto Count
123125
)
124126
)

0 commit comments

Comments
 (0)