How to clear server cache and client cache using BAT file

Clear client cache

If you want to delete the 1C cache for users, which is located at:
%userprofile%\AppData\Local\1C\1cv8

Location for the Roaming directory:
%userprofile%\AppData\Roaming\1C\1Cv8

Where %userprofile% is the current Windows user profile.

The folder names here look like 3e0f3bca-00dc-4d2d-9707-42e43ce4ea03 - these are unique database identifiers.

To automate this, you can use the following .bat script:

@echo off
FOR /D %%i in ("C:\Users\*") do (
    FOR /D %%j in ("%%i\Local settings\Application data\1C\1Cv8\????????-????-????-????-????????????") do rd /s /q "%%j" 2>nul
    FOR /D %%j in ("%%i\AppData\Roaming\1C\1Cv8\????????-????-????-????-????????????") do rd /s /q "%%j" 2>nul
)

What this script does: It recursively deletes all directories with GUID names (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) in user profile folders:

  • Local settings\Application data\1C\1Cv8\
  • AppData\Roaming\1C\1Cv8\

WARNING! This script permanently deletes data. Use with caution and ensure that cleaning these directories is necessary beforehand.

WARNING! All 1C sessions on the computer must be closed, otherwise the data will not be completely deleted.

Clear server cache

To delete server cache use this script which needs to be run from a user with Administrator rights

#################################################
# Stop 1C:Enterprise Server x64 service
#################################################
echo Stopping 1C:Enterprise Server service...
net stop "1C:Enterprise 8.3 Server Agent (x86-64)"
timeout /t 3 /nobreak >nul

#######################################################################################
# Forcefully terminate 1C server processes if they didn't stop properly
#######################################################################################
echo Terminating remaining 1C processes...
TASKKILL /F /FI "IMAGENAME eq rphost*" 2>nul
TASKKILL /F /FI "IMAGENAME eq rmngr*" 2>nul
TASKKILL /F /FI "IMAGENAME eq ragent*" 2>nul
timeout /t 2 /nobreak >nul

############################################################
# Delete user 1C cache (if needed)
############################################################
echo Cleaning user 1C cache...
@echo off
FOR /D %%i in ("C:\Users\*") do (
    FOR /D %%j in ("%%i\Local Settings\Application Data\1C\1Cv8\????????-????-????-????-????????????") do rd /s /q "%%j" 2>nul
    FOR /D %%j in ("%%i\AppData\Roaming\1C\1Cv8\????????-????-????-????-????????????") do rd /s /q "%%j" 2>nul
    FOR /D %%j in ("%%i\AppData\Local\1C\1Cv8\????????-????-????-????-????????????") do rd /s /q "%%j" 2>nul
)

###################################################
# Delete enterprise server session data
###################################################
echo Cleaning server session data...
for /d %%a in ("C:\Program Files\1cv8\srvinfo\reg_1541\snccntx\*") do rd /s /q "%%a" 2>nul

##################################
# Start 1C server x64 service
##################################
echo Starting 1C:Enterprise Server service...
net start "1C:Enterprise 8.3 Server Agent (x86-64)"
echo Operation completed.

This script performs a complete forced cleanup and restart of the 1C:Enterprise server. 

Here's what it does step by step:

1. Stop 1C service

2. Forcefully terminate processes

  • Kills non-responding server processes
  • Guarantees release of files and memory

3. Clear user cache

4. Clear server data

  • Deletes server session data

  • Cleans temporary worker process files

 5. Start 1C service

When to use this script:

  • When experiencing connection problems to databases
  • After server crashes - for complete reset
  • During licensing errors
  • To free up disk space

Consequences of execution:

  • All users will be disconnected from databases
  • First 1C launch after cleanup will be slower (cache rebuild)
  • Temporary loss of user settings

 

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002