Why does this not work? It doesn't make sense! It's just refusing to do any code: @echo off set tested=0 set name= set file=Data_file :test_file set cnt=0 if exist "%file%.txt" do ( for /F "delims=" %%j in (%file%.txt) do ( set /A cnt+=1 if %cnt% == 1 ( set name=%%j set /A cnt-=1 ) else set line!cnt!=%%j ) goto start ) else ( goto new_data ) :new_data cls if %tested% == 1 ( echo.Error: Couldn't create new data. pause >nul echo.Try again? ) if %tested% == 0 ( echo.No data found. pause >nul echo.Create new data? set tested=1 ) choice if %errorlevel% == 1 call :name if %errorlevel% == 2 ( echo.Ok. Program will now close. pause >nul exit ) goto test_file :name cls echo.What is your name? set /p name="" echo.%name%>>"%file%.txt" :start rem Put code in later pause >nul
The output is usually just the pause then it closes. And no, the data file doesn't exist. And yes, I have tried switching the data file's name (many times).Also: Thanks ahead of time! I would like help soon (though I can wait)!
I didn't check it all, but this jumps out at me: if exist "%file%.txt" do (There shouldn't be a "do" there, that's only for "for" loops:
if exist "%file%.txt" (
@Judago Thanks! It's always the stupid errors that cause the most harm :P