tcl1

[Batch] Saving and loading

Feb 15th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.25 KB | None | 0 0
  1. REM I saw a paste that needed saving and loading, so I decided to put this up :D
  2. @echo off
  3. cls
  4. goto misc
  5. :misc
  6. cls
  7. set /a data+=1500
  8. goto menu
  9. :menu
  10. cls
  11. echo Data saving test
  12. echo Data amount: %data%
  13. echo Press S to save, Press D to load, press F to reduce data amount & echo ,press I to increase save amount and press C to delete & echo your save file.
  14. choice /c SDFIC /n
  15. if %errorlevel%==1 goto save1
  16. if %errorlevel%==2 goto load
  17. if %errorlevel%==3 set /a data-=100 & goto menu
  18. if %errorlevel%==4 set /a data+=100 & goto menu
  19. if %errorlevel%==5 goto erasefile
  20. :save1
  21. cls
  22. echo Saving...
  23. timeout /t 1 /nobreak >nul
  24. goto save2
  25. :save2
  26. cls
  27. echo ::File auto generated at %time% %date% >>SaveData.bat
  28. cls
  29. echo set /a data=0 >> SaveData.bat
  30. cls
  31. echo set /a data+=%data% >>SaveData.bat
  32. cls
  33. goto menu
  34. :load
  35. cls
  36. if not exist SaveData.bat cls & echo No save data has been saved. & timeout /t 1 /nobreak >nul & goto menu
  37. cls
  38. if exist SaveData.bat call SaveData.bat
  39. cls
  40. echo File loaded! & timeout /t 1 /nobreak >nul & goto menu
  41. :erasefile
  42. if exist SaveData.bat del SaveData.bat & cls & echo Save file deleted. & timeout /t 1 /nobreak >nul & goto menu
  43. if not exist SaveData.bat cls & echo No save file to delete. & timeout /t 1 /nobreak >nul & goto menu
Advertisement
Add Comment
Please, Sign In to add comment