Page 1 of 1

DOS dir /B: want to store evaluated output

Posted: 09 Apr 2008 20:07
by Vertebraille
Hi,
I've got to write a batch file at work which renames a file (slx_callhistory*.txt) to slx_callhistory.txt, calls an external app, then renames slx_callhistory back to what it was originally

the problem i'm having is, i'm doing a

dir slx_callhistory*.txt /B, and trying to set this output in a variable,
but I don't want the variable to contain the dir call, i want it to contain the output

is there any way of doing this, or can somebody suggest a better way to go about the problem?
Thanks

Posted: 09 Apr 2008 22:31
by Vertebraille
solved!
used FOR /F %%a IN ('dir slx_opportunity*.txt /B') DO (SET thefilename=%%a).

Posted: 29 Apr 2008 01:12
by DosItHelp
Or simply:
FOR %%a IN (slx_opportunity*.txt) DO SET thefilename=%%a
:wink: