1.

Solve : WHY WONT THIS BATCH FILE WORK!!!!!!!!!?

Answer»
Why wont this BATCH FILE work???

The point of it is to convert png FILES to jpg in a certain directory.
It finds files in the directory that are named like this:
1.png
2.png
3.png
ect...

It EXITS as soon as you input the directory!!!!!

Code: [Select]@ECHO off
:d
cd C:/Users/%USERNAME%
pause
set /p start=Starting Number:
set /a start2=%start% - 1

set /p dir=Directory
if not exist %dir% (
echo %dir% has not been found!
pause
cls
goto :d
)
if exist %dir% (
goto a
)
:a
set /a next=start2 + 1
if exist %dir%/%next% (
ren %dir%/%next% %next%.jpg
set /a per=100/%next%
cls
echo %per%%
cls
goto a
echo.
echo.
echo Done!
pause
cls
goto dWelcome to CH. Please do not shout.
May I assume you are a beginner?
Suggestions.
1. do not use echo off until you got it right.
2. beak you code into little parts and stubs.
3. avoid indirection until you have it right.
Like
Code: [Select]cd C:/Users/%USERNAME%Is not needed until you have tested the thing. You start in the test directory manually. Less likely to mess things up.It appears that you are simply renaming from png to jpg. Do you understand that you need to actually CONVERT the file format, not just change the extension?goto :d should just be goto d. No need for the semicolon.


Discussion

No Comment Found