1.

Solve : To Detect and To work in FOR files (BAT)?

Answer»

Hello, with MS-DOS I WORKED very LITTLE with Files for lots (BAT) or to program, and today I need to create a file since CONVERSOR.BAT that it carries out a task, I am working with Delphi7 (with one of their tools "brcc32" that transforms files creating resources of File.rc to File.res). My BAT, contains these lines:

Code: [Select]PATH C:\Archivos de programa\Borland\Delphi7\Bin
brcc32 PRUEBA.rc PRUEBA.res CONVERSOR.BAT detects where is the executable one "brcc32" for to TRANSFORM a file of resources of ". rc" to ". res", it works very well in the current directory that it is when giving him double CLICK.

The problem is that when I believe another file. rc, every time I have to edit my CONVERSOR.BAT to change the names of the file in the second line (Example: brcc32 OtherFile.rc OtherFile.res)

Then what Do I require is that my File BAT makes the following when doubble click:

1. - it detects the files *. rc that exist in the current directory
2. - that Counts them, How did many find? (Or THAT DIRECTLY it EXECUTES THE bcc32 with those finded)
3. - to make a FOR until the quantity that Counted
4. - inside the FOR to Make work: brcc32 for all the opposing files "*. rc" to "*. res" in the current directory) and this way to transform them.

What Do You say of the following code?

Code: [Select]Set path = %path%;C:\Archivos de programa\Borland\Delphi7\Bin
FOR %%FileRec IN (*.rc) DO brcc32 %%FileRec %%FileRec.resit doesn't work

GreetingsThe token in a FOR statement MUST be a single alpha character and yes, case matters.

Set path = %path%;C:\Archivos de programa\Borland\Delphi7\Bin
FOR /f %%a IN ('dir /b *.rc') DO brcc32 %%a %%a.res

Hope this helps. 8-)Thanks, it Works



Discussion

No Comment Found