Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
TheHunterManX
- Posts: 54
- Joined: 14 Aug 2015 05:59
#1
Post
by TheHunterManX » 17 Mar 2016 06:09
So I want to make a buttload of the same png file name to make it easier on my behalf. Could someone tell me what is wrong with the code below?
Code: Select all
set Number=0
for %%a in (.) do set currentfolder=%%~na
echo. > "%currentfolder%.png"
for %%f in (*.png) do (
REM Sets file as the file name...
set File="%%~nf Sprite"
)
:A1
set /a Number=%Number%+1
echo. > "%File% %Number%.png"
if %Number% EQU 5 pause
if %Number% EQU 20 pause
if %Number% EQU 50 pause
goto A1
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 17 Mar 2016 06:54
Does this float your boat?
Code: Select all
@echo off
for %%a in (.) do set "File=%%~fna Sprite"
for /L %%a in (1,1,2000) do break>"%file% %%a.png"
-
TheHunterManX
- Posts: 54
- Joined: 14 Aug 2015 05:59
#3
Post
by TheHunterManX » 17 Mar 2016 07:05
Looked like it would work, but after about 2 seconds the cmd closes, and nothing happens. Could it be that i am using windows xp? Probably not but it will not work
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#4
Post
by foxidrive » 17 Mar 2016 07:16
It's using the path incorrectly.
This is more robust:
Code: Select all
@echo off
for %%a in ("%cd%") do set "File=%%~a\%%~na Sprite"
for /L %%a in (1,1,20) do break>"%file% %%a.png"
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#6
Post
by foxidrive » 17 Mar 2016 07:51
Excellent.
If it is every PNG file in the folder then this should be effective too.
Code: Select all
@echo off
for %%a in (*.png) do break>"%%a"