windowscommand-line-tool

Read a line of text and set it as a variable for a batch file


I want to put a date/time in a line in a text file then have my batch file use that date to compare against the current date/time. How would I do that?


Solution

  • To define a windows variable from text in a file:

    set MYVAR= type abc.txt
    

    set is used to tell the computer to set a variable called my var and type abc.txt is the command to read a files contents.