Creating a batch file to start The Sims 2 & Body Shop while cleaning junk files
#1 20-05-2017 
I'd like help from folks who're more experience making batch files to more easily start up my game. Right now, I have one batch file that reads as follows:

Code:
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Accessory.cache"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Groups.cache"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\cigen.package"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\*.mdmp"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Logs\*.*"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Thumbnails\*.*"

Right now, the batch file removes the top three files, if they exist, and on the fourth line removes .mdmp files. The last two lines pose a question asking if I am sure that I want to delete all files in those folders (one question for each line). I have to manually type in "Y" for yes.

What I'd like to have in the batch file is:
- The ability to erase all files in those folders without posing a question verifying if I'd like to delete them.
- The ability to execute my game without having to double-click the shortcut to the Maxis EXE file.
- As well as to start the game in windowed mode, in 1920x1080 pixels resolution, in 1 (out of my 2) core, in "low" priority memory usage.

How would that be written?
d_dgjdhh, proud to be a member of LeeFish since Apr 2013.
(This post was last modified: 24-05-2017 03:25 AM by d_dgjdhh.)

0
#2 21-05-2017 
0. Did you know that every command you can perform in a batch file, can also be typed on the command line (in a dos box), and you can prepend them with "help" to get information about their usage?
1. Any line containing wildcards (like *.*) can potentially affect a LOT of files, so they built in the confirmation question specifically for such lines. They did this on purpose. just to make sure you don't shoot yourself in the foot. But they also built in an option to disable that feature.
2. Typing "help erase" in a dos box (on a command line) would result in the system telling you how to fix this specific problem.
3. After typing "help erase", you'll see that adding /Q to the last two lines would cause them to be performed silently; that is WITH NO QUESTIONS ASKED. Remember how dangerous it is to circumvent this specific safety feature. You could accidentally and permanently delete stuff that you do NOT want deleted.
4. There is even an option /P, that does the inverse, and forces the confirmation question on all lines that would normally be done without confirmation.
5. I've checked "help sims2ep9.exe" to see if help and sims support each other. They don't. It is suggested that one might try "sims2ep9.exe /?" to get more information. But alas, that simply starts the game. So at this moment, I have no idea how to force playing in a window from a batch file, or how to alter the resolution of said window. I'm still looking for other options...

If anyone thinks this post is condescending or offensive, I'm sorry. I've given a LOT of information about the command interface here, AND about how to find information for yourself, while at the command line. This information is good, not only for the DEL/ERASE command, but for many command line functions.

1
#3 21-05-2017 
  • Registered
  • 3
  • 9
start /low /affinity 1 /b /d "C:\Program Files (x86)\EA GAMES\The Sims 2 Mansion and Garden Stuff\TSBin" Sims2EP9.exe -w

The size of the window will be whatever resolution you've picked from within the game

1
#4 21-05-2017 
@whoward69 I would like to know how you found that information. Because that would help others find similar stuff for themselves later, if they need it.

0
#5 21-05-2017 
  • Registered
  • 3
  • 9
Google "start sims 2 in windowed mode" brings up the -w trick as the first answer.

I "just know" the /affinity switch, as I use it frequently at work

0
#6 21-05-2017 
To create your own batch files, command-line reference: https://technet.microsoft.com/en-us/libr...90890.aspx

For deleting:

del /q /s "C:\Program Files (x86)\Origin Games\The Sims 2 Ultimate Collection\Apartment Life\TSData\Res\NeighborhoodTemplate\E002"

The /q is quiet, no questions asked. The /s is for subfolders. My sample is from a .bat file for cleaning hoods.

0
#7 21-05-2017 
Thanks for the info everyone.

When I was Googling information about batch files, it felt like gibberish and a steep learning curve on how to make up commands. I didn't think of using MS-DOS to see what command lines are available to use. As well, since there's so many command lines possible, it would take long to learn it.

EDIT:
Okay!!!! Got my batch file to do what I wanted. Here it is for anyone else who wants to use it:

EDIT 2: Made the batch file better.

Code:
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\*.cache"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\ContentRegistry.*"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\cigen.package"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\*.mdmp"
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Logs\*.*" /Q
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Thumbnails\*.*" /Q
start /d "C:\Program Files (x86)\EA GAMES\The Sims 2 Mansion and Garden Stuff\TSBin\" cmd.exe /c start /low /affinity 2 Sims2EP9.exe -w -r1600x900

@whoward69

Unfortunately, the command line didn't work in my case. It kept starting the game in "Normal" priority with both CPUs being used. But now this code works to do what I'm looking for. I made an image for folks who stumble upon this thread too, maybe breaking down the command lines would help others be able to interpret what I did:

[Image: 76608_170521224115BatchFileNotesA.png]
________________________________________________________________

EDIT 3: Okay, next question. Is there a way to shorten this code of commands? Like, is there a way to tell the batch file to go into the "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\" directory, then delete the cache files & mdmp files & ContentRegistry item & cigen.package file at once? Or does each file have to have its own command line?

EDIT 4: Okay, so I created a batch file that's even smaller to use. The following commands are for playing the game:

Code:
cd C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2
erase *.cache
erase *.mdmp
erase cigen.package
erase ContentRegistry.*
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Logs\" /Q
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Thumbnails\" /Q
cd C:\Program Files (x86)\EA GAMES\The Sims 2 Mansion and Garden Stuff\TSBin
cmd.exe /c start /low /affinity 2 Sims2EP9.exe -w -r1900x1200

The next command lines are for launching BodyShop:

Code:
cd C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2
erase *.cache
erase *.mdmp
erase cigen.package
erase ContentRegistry.*
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Logs\" /Q
erase "C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2\Thumbnails\" /Q
cd C:\Program Files (x86)\EA GAMES\The Sims 2 Mansion and Garden Stuff\CSBin
cmd.exe /c start /low /affinity 2 TS2BodyShop.exe

So yay, another way of executing the game (or BodyShop) while cleaning up junk files.
(This post was last modified: 22-05-2017 02:39 AM by d_dgjdhh.)

1
#8 22-05-2017 
In fact, if you're already in C:\Documents and Settings\Administrator\My Documents\EA Games\The Sims 2, then the last two "Erase" commands can be shortened a lot, too.
Simply rewrite them to read

erase Logs\*.* /Q
erase Thumbnails\*.* /Q

And even better, in stead of "erase", use "del"

0


Sorry, that is a members only option