![batch batch read file into variable batch batch read file into variable](https://i.stack.imgur.com/hwa5W.png)
Test this program and change the echo File "%%a_%%b.%%c". xsomecommand The Windows command processor does not have direct backquoting, but you can fake it by abusing the FOR command. I need a batch script that can read a line from a csv, process a series of commands using that line as a variable in the commands, then go on to. In unix-style shells, this is done via backquoting. Catherine Georganas on UPDATED Batch-file-read-csv-variable.
![batch batch read file into variable batch batch read file into variable](https://i0.wp.com/win10.guru/wp-content/uploads/2020/07/Add-Content.jpg)
There is no obvious way to read the output of a command into a batch file variable. Rem The assumed format is MM/DD/YYYY, change C-A-B order in accordance with your localeįor /F "tokens=1-3 delims=/" %%a in ("%date%") do (įor /F "tokens=1-3 delims=_." %%a in ('dir /B /A-D *.*') do (Įcho File "%%a_%%b.%%c" is !daysOld! days old
#Batch batch read file into variable code#
Rem Get Julian Day Number of today's date Re: Read multiple specific lines in txt file - save each line into a variable -Batch Reply 1 on: July 29, 2020, 10:09:23 AM This is written as a stand alone batch file, but you can remove any duplicate code and copy it into your existing code. The number of days to delete files is given in the parameter. The Batch file below convert file date to Julian Day Number, that is a sequential number of days, and use it to know how many days old is each one.