Reputation: 9
So my friend gave me a batch file he wanted me to check if everything is correct, but I've got no clue what =<
does in this.
:artthou_54
mode 50,20
cls
set videopath=0
title Art thou sure?
set /p videopath=<\DataTron\Ainstro\YePathToVido.dat
if %videopath%=="" echo Video Path = %videopath%
if %videopath%=="C:\Vodie" echo It seems you have the same path as the creator
set /p videopath="Would you like to open %VideoPath%? (Y/N): "
mode 50,20
if %videopath%==Y goto videohole-b
if %videopath%==N goto videohole
if %videopath%==y goto videohole-b
if %videopath%==n goto videohole
if %videopath%==back goto videohole-c
if %videopath%==exit exit
goto Art-thou-unsure
Upvotes: 1
Views: 1303
Reputation: 14315
That line sets the first line of YePathToVido.dat to the variable videopath
.
set /p
gets input from the user and reads in until it receives a CRLF
.
<
redirects input from the specified file and sends it to the set /p
command. Since set /p
reads until it receives a CRLF
, this effectively tells the command to read from the start of the file until the end of the first line.
if
statements are incorrect because batch compares everything on both sides of the ==
, including the quotes. Those lines need to change to if "%videopath%"==""
and if "%videopath%"=="C:\Vodie"
, respectively.
Upvotes: 3