[Tutorial] Delete cache automatically and initialize

Description / What’s this for

Here is a type of server initializer, this allows you to delete the cache of your server, without going to the folder and delete, and also asks if you want to do this. Shortly after clearing the cache, the server starts automatically.

Screenshot_6

HOW TO USE?

  1. Go to your Desktop and create a .txt file with any name.

  2. Open it, paste the whole text of commands that is below.

  3. Change all “C:\TEST” paths to the path that is the folder of your server. (Examples: “C:\Octane\cache” “C:\Octane\start.bat”)

  4. Change the names “TEST” to the name of your server or any desired name.

  5. Go in the upper left corner, click “File” and go to “Save As…”.

  6. Put any name in the file and at the end put .bat (Example: Octane.bat), click on “Text Documents (*.txt)” and change to “All Files”, select the folder you want to save and click in “Save”.

  7. After saving the .bat file, place it in the root folder of your server. (Example: C:\Octane)

  8. Done, you will always use this file to start your server

If you wish, make a shortcut to Desktop so you do not need to go to the server folder every time you use the file:
Right click on the file, go to “Send to” and select “Desktop (create shortcut)”. Now whenever you want to start the server just open the file that you sent to the Desktop.*

@CHCP 1252 >NUL
@echo off
@title FiveM Server - TEST
cls
color 0a
:start

echo                               TEST
echo                               by 20_
echo.
echo.
echo.
echo  Wait...
echo.
echo.

timeout /t 3 >null

:choice
set /P  c=Do you want to delete the cache? (Y/N)
if /I "%c%" EQU "Y" goto :somewhere
if /I "%c%" EQU "N" goto :somewhere_else
goto :choice
:somewhere
echo.
echo.
echo  Deleting...
 rd /s /q "C:\TEST\cache" 

timeout /t 3 >null

echo %time% - The cache has been deleted.

timeout /t 3 >null

:somewhere_else
start C:\TEST\start.bat
echo %time% - The server is starting...

timeout /t 2 >null
echo %time% - Initializing resources...

timeout /t 3 >null
echo %time% - The server is online.

***WARNING

If you have any problems regarding phrases, letters or something visual, remove the three commands:

  • @CHCP 1252> NUL
    Used to allow accentuation in letters. (Basically)

  • cls
    Used to clean the screen of anything that is written.

  • color 0a
    Used to add color to text. If you want to change the color, here’s the list of codes with preview: https://ss64.com/nt/color.html

5 Likes