error in for loop

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
doscode
Posts: 175
Joined: 15 Feb 2012 14:02

Re: error in for loop

#16 Post by doscode » 04 Jun 2012 02:48

I asked incorrectly. So I ask again.

I have a loop where I delete files. In the loop I have:

Code: Select all

SET file=%%~nxI
del "%tpath%\!file!" /Q
del "%jpath%\!file!" /Q


Line #2 contains extension .bmp .
Line #3 also contains extension .bmp .
I would like to change line #3 extension to jpg. The text I look, need not to be variable.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: error in for loop

#17 Post by foxidrive » 04 Jun 2012 03:34

Code: Select all

SET file=%%~nI
del "%tpath%\!file!.bmp" /Q
del "%jpath%\!file!.jpg" /Q

doscode
Posts: 175
Joined: 15 Feb 2012 14:02

Re: error in for loop

#18 Post by doscode » 04 Jun 2012 04:06

thanks ;-)

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: error in for loop

#19 Post by Squashman » 04 Jun 2012 07:00

If you already new that the N and X were for the file name and extension why didn't you just take the X out in the first place? Scratch my head on that one. :?:

Post Reply