Posted By

stianlagstad on 03/27/13


loop directory batch dos for

Versions (?)

Batch code to process files with a certain filename in a directory

 / Published in: DOS Batch

This will loop through files in somefolder with the extension .c, print out the filename and compile the files.

  1. @echo off
  2. cd %USERPROFILE%\Desktop\somefolder
  3. for %%f in (*.c) do (
  4. echo %%~nf
  5. gcc -c %%~nf.c -o %%~nf.o
  6. )

Report this snippet  

You need to login to post a comment.