Reputation: 1
I have never written a batch script before but would like to use one to run & write the output of a command line utility I use on a regular basis. I would like it to write to a text file using a string returned by the utility as a file name (serial number in this case). There are a few problems here. The code ideally would:
I have a bit of it in place, but I am struggling with having it parse the output into a variable and then use that variable to name the text file. Currently it looks like:
Is this even possible? Helps!
Upvotes: 0
Views: 1921
Reputation: 11367
@echo off
for /f "tokens=2 delims== " %%A in ('utility') do set "SN=%%~A"
utility>>"%SN%.txt"
Upvotes: 1