mercredi 1 décembre 2021

Problem with batch file doesn't detect file

I have a problem with my program, I don't know how can I make it detect that the file NewFile(%i%) exists.

for /l %%i in (1, 1, 100) do (

if EXIST NewFile(%i%).txt (
echo "New file"> NewFile(%%i).txt
goto EndLoop
)

if EXIST NewFile.txt(
echo "New file"> NewFile(%%i).txt
goto EndLoop
) else (
echo "New file"> NewFile.txt
goto EndLoop
)

)

It says ") was unexpected at this time."
How can I fix this?

Aucun commentaire:

Enregistrer un commentaire