0

I have a file name, i can extract it as so (using cygwin and a DOS prompt):

ls REL*.xml

which produces an output as so:

REL_LVVE_HF_NV3_VC_AGC_RX_WBE_DRC_RX_WB_VIDPP_debug.xml

How do I write a batch file to read that filename/output into a variable?

2
  • If you're already using cygwin and like the *nix style commands better, you might consider trying PowerShell rather than batch for scripting in Windows. It's already included with all versions of Windows since Vista. Commented Sep 18, 2014 at 22:19
  • thanks, but i have to integrate this into an existing batch file Commented Sep 18, 2014 at 22:36

1 Answer 1

1

from command line:

for %a in ("REL*.xml") do set "fn=%~a" 

from batch file

@echo off pushd "c:\dir_with_the_file" for %%a in ("REL*.xml") do set "fn=%%~a" echo %fn% 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.