user2507295
user2507295

Reputation: 159

Windows commandline: get Lines from text file

With command line in Windows, I have a game score system which goes on. It saves the scores into a text file by using the code:

if %LS_RegioLex_EndSave%==1 (echo Single Player Latest Score 1 - RegioLex: %S_REGIOLEX_SCORE% > LostChamberSinglePlayerRegioLexSCORE01.txt)

How do I do the opposite and get the saved scores from the text file and display them?

Upvotes: 0

Views: 128

Answers (2)

thisguy123
thisguy123

Reputation: 945

Assuming you load the .txt to a string, you can split a string as shown in this thread, or as shown here

Any reason you're tied to batch? Powershell makes it a cakewalk with Import-CSV

Upvotes: 1

foxidrive
foxidrive

Reputation: 41224

This gives you the data on the first line.

set /p "var="<"LostChamberSinglePlayerRegioLexSCORE01.txt"
echo "%var%"

Upvotes: 0

Related Questions