I'm having an issue with an URL in an if-statement using batch.
@ECHO OFF
SET /P input="Insert Link "
if %input%==l (echo true) else (echo false)
cmd /k
I want to determine if the user input is a link or a single character (in this case l). I get that the operators within the URL might cause the problem. But shouldn't the if-statement just check if %input% is l and everything else would trigger the else? Using SET %input%=l leads to the true case being triggered.
Any ideas on how to make this work in a simple way? Am I missing something regarding syntax?
setoption:Set /P "input=PromptString". The correctIfcommand would beIf "%input%" == "l" (Echo true) Else Echo falseorIf /I "%input%" == "l" (Echo true) Else Echo false(forLorl).SET input=https://www.youtube.com/watch?v=6zswl5YrvVwfor testing purposes. I'm going to edit the OP so my question and the given code are matching.