read filename & execute pgm

Dell / D630
January 15, 2009 at 10:15:31
Specs: Windows XP, 1GB
I've a folder with multiple files: aaa_xxx_yyyymmdd.txt

Please help me in creating a DOS script that will read the file in this folder 1 by 1 & then execute a BAT file with that name.

eg, read aaa_xxx_yyyymmdd.txt, run xxx.BAT; read bbb_zzzzz_yyyymmdd.txt, run zzzzz.BAT.

These BAT files will be in a different folder.

See More: read filename & execute pgm

Report •

January 15, 2009 at 23:46:51
I'm a little unclear on this, why is the file read?

Do you mean read the file names from a folder, then take the part of each file name that is contained within underscores and call a batch file named the said partial file name? (for some reason that was harder to put into words than I first thought???)

Of course one by on....

Are you really using DOS or do you think that is what the command line in Xp is called?

If your using the xp command processor(cmd.exe) it shouldn't be too difficult...


For /f "delims=" %%a in ('dir "drive:\dir\folder" /b/a-d') do (
for /f "tokens=2 delims=_" %%b in ("%%a") do call "drive:\dir with you batches\%%b.bat

Of course you would need to fill in the path names and as noted it is untested...

Report •
Related Solutions

Ask Question