-1

i have files named..

82011.nsf
63113.nsf
55555.nsf

i must rename each file to single.nsf (for example ren 82011.nsf to single.nsf)

then use a program to act on that file (single.nsf)

then rename the next file (63113.nsf to single.nsf) then use a program to act on that file (single.nsf) etc

I want a batch file to do the nename, pause (so i can run the other program), then do the next rename until all nsf files are done.

how?

codaddict
  • 445,704
  • 82
  • 492
  • 529
curtb
  • 1
  • Does the other program have a flag that you can use to specify a filename, so that you don't have to rename each one as `single.nsf`? Or if not, do you have the code to that program so that you can add that facility? – Richard Fearn Sep 04 '10 at 14:33

2 Answers2

1
for %i in (*.nsf) do ( 
  rename %i single.nsf 
  do_the_job 
  pause 
) 
Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • thnak you for your help this is the final solution for me. for /f %%v IN ('dir /b *.era') do copy %%v nownsf.nsf & pause – curtb Sep 11 '10 at 16:25
-1

This should work:

for /f %%fname IN (‘dir /b *.nsf’) do call myprog %%a

[src]

Jim W
  • 4,890
  • 2
  • 20
  • 26
aularon
  • 11,042
  • 3
  • 36
  • 41
  • You cannot use `%%fname` there. Also you shouldn't use `for /f` over the output of `dir` unless it's absolutely necessary. While it may have worked for this case you get yourself in minor pain with file names that contain spaces or Unicode characters that don't have a representation in the OEM codepage (unless you're using a TrueType font for the console; but that isn't the default, so always expect things to break). – Joey Sep 12 '10 at 10:34