Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Mad Poster
Original Poster
#1 Old 7th Dec 2016 at 2:05 PM
Default Tutorial: Clearing cache with a batch file
Some time ago, I mentioned I made a batch file to automatically clear out the cache files before launching the game. Although I posted it, I thought I'd make a tutorial.

1. backup your save folder first! Batch files can be pretty touchy. Some years ago I accidentally deleted an entire folder with one. We don't want that to happen.

2. Navigate to your save folder. It should look something like
Code:
C:\Users\[ihate]\Documents\EA Games\The Sims 2\

although the path will be different for the UC.

3. Open Notepad (or your text editor of choice). Go to File > Save, and navigate to the save folder. Select "All files" under 'save as type' and name it Sims2Start.bat. The important thing is the .bat extension, as this tells the OS that it's a batch file.

4. Add these three lines to the batch file, editing the paths as necessary.

Code:
C:
del "C:\Users\[ihate]\Documents\EA Games\The Sims 2\Accessory.cache"
del "C:\Users\[ihate]\Documents\EA Games\The Sims 2\Groups.cache"


This tells the batch file to delete these two cache files.

5. Find the folder for your latest EP. Normally, it's under Program Files/Program Files (x86) but I don't use the standard path. Mine is:
Code:
C:\Games\The Sims\The Sims 2\The Sims 2 Mansion and Garden Stuff\TSBin\Sims2EP9.exe


A good way to do this is to go to your desktop shortcut, right click it, click Properties, and check the "Target" box under the shortcut tab.

6. Add this line to the batch file, changing it to the executable path:

Code:
start "" "C:\Games\The Sims\The Sims 2\The Sims 2 Mansion and Garden Stuff\TSBin\Sims2EP9.exe"


This tells the batch file to launch the executable. If you play in windowed mode, just add -w to the end of this. (For some reason, the batch file won't work properly without those two spare quotation marks.)

7. Test the batch file. Make sure it works properly.

8. Once it's working, you can replace your shortcut with it. Remember what I said earlier about the desktop shortcut properties? Just take the path to your batch file:

Code:
C:\Users\[ihate]\Documents\EA Games\The Sims 2\Sims2Start.bat


and paste it into that target box. If there's anything under the 'Start In' box just delete it.

Now you won't have to worry about remembering to clear the cache files.

Any questions? Ask below.

I'm secretly a Bulbasaur. | Formerly known as ihatemandatoryregister

Looking for SimWardrobe's mods? | Or Dizzy's? | Faiuwle/rufio's too! | smorbie1's Chris Hatch archives
Advertisement
Field Researcher
#2 Old 8th Dec 2016 at 7:35 AM Last edited by G-Mon : 25th Dec 2016 at 2:08 AM.
Nifty. I actually wrote a couple batch files to clear out my caches, both Sims 2 and Sims 3 (they're separate from each other, of course). For my Sims 2 cache clearer, I actually condensed step 4 into one line:
Code:
for %%f in (Groups.cache cigen.package ContentRegistry Accessory.cache) do if exist %%f del %%f
...which tells the batch file to cycle through "Groups.cache", "cigen.package", "ContentRegistry", and "Accessory.cache", checking for the existence of each file, and deleting each one that does exist.

Users of multicore systems may also want to change the last line in the batch file (the one that launches the game) to read (adapted from advice in "TS2 and Multicores"):
Code:
start /affinity 1 /d "C:\Games\The Sims\The Sims 2\The Sims 2 Mansion and Garden Stuff\TSBin" Sims2EP9.exe
This tells it to start the game with only one CPU core allocated, which can help alleviate minipauses and jerkiness. (NOTE: This won't help at all with single-core systems, and players with the game installed on a SSD may not need this.)

EDIT: Turns out I goofed up on the line to launch the game, in that last block. Herp, and furthermore, derp. Fixed.

WARNING: Professional Lurker Alert!
Quote:
"Ew, trees [WooHoo-ing]."

-- "Oral Pollination", Not Always Right
Instructor
#3 Old 8th Dec 2016 at 8:39 AM
As we're sharing ...

My startup batch file uses the command line that comes with WinRAR to backup my custom hood (N004) before it starts the game (Bon Voyage in my case)
Backups are created as N004_YYYYMMDD_HHMM.rar

Quote:
@echo off

set sims2_game="The Sims 2 Bon Voyage"
set sims2_exe=Sims2EP6.exe
set hood=N004

cd %HOMEPATH%
cd "My Documents\EA Games\The Sims 2"

echo Cleaning cache
for %%f in (Accessory.cache cigen.package Groups.cache) do if exist %%f del %%f

for /f %%x in ('"time /t"') do set t=%%x
set now=%t:~0,2%%t:~3,2%
set today=%DATE:~6,4%%DATE:~0,2%%DATE:~3,2%
set backup=%hood%_%today%_%now%.rar

echo Backing up to %backup%
cd "Neighborhoods"
"C:\Program Files\WinRAR\Rar.exe" a -idq -r %backup% %hood%\*.*

echo Starting %sims2_game%
cd "C:\Program Files\EA GAMES\%sims2_game%\TSBin"
%sims2_exe%


Note: It was written for Windows XP, you'll need to tweak it for later versions where "My Documents" is just "Documents"

Just call me William, definitely not Who-Ward
Back to top