I will be receiving a file from a different system and will process it. However the filename is dynamic.
INFILE_IETPAT_V_NNNNNN_NNN.CSV ( Where N is a numeric value )
I need the actual filename for processing it. Please note at a time only one file will be present inside VDMT folder.
I have written following piece of code-
set filename=%dir/b C:\VDMT\INFILE_IETPAT_V*%
however the output of dir command is not being stored rather the whole %dir/b .....% string is being stored.
Can anyone please throw some light?
storing command output in a variable
Moderator: DosItHelp
-
- Posts: 2
- Joined: 23 Nov 2008 01:06
- Location: India
rmukherjee,
You could try:
Or:
DosItHelp?
You could try:
Code: Select all
For %%A in ("C:\VDMT\INFILE_IETPAT_V*") do set "filename=%%A"
Or:
Code: Select all
For "delims=" %%A in ('"dir /b "C:\VDMT\INFILE_IETPAT_V*%""') do set "filename=%%A"
DosItHelp?