Reputation: 101
I came across a batch script with line set /p TestVersion=<version.txt
My interpretation of this command line is :- /p signifies pause the script till the version.txt is read and feed its value to TestVersion ?
Is =< symbol used when an input is fed to other variable ?
Pls clarify the symbol details.
Thank you
Upvotes: 1
Views: 62
Reputation: 14305
That code takes the first line of version.txt and stores it in the variable TestVersion.
set /p
is a command for taking in user input, and <
is an input redirection symbol. When data is piped into a set
command, it is read in one line at a time per instance of input redirection, so you can run that line over and over and it will always give the same result, but if you say something like
(
set /p first_line=
set /p second_line=
)<version.txt
then first_line will contain the first line in the file and second_line will contain the second line in the file.
Upvotes: 4