News:

Welcome to World of Banished!

Main Menu

.bat File for Automatic Registry Mod Cleanup

Started by MarkAnthony, July 17, 2019, 01:59:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarkAnthony

Good evening.

I manually delete my registry entries for Banished mods when I switch between large groups of mods (when I switch ModMan profiles); I do so out of habit because it just makes me feel better.

I was just wondering if one of you could write a .bat file to do it for me automatically; so that every time I want to clean it I just need to double-click the .bat file?



I would need it to delete everything that would appear between the two entries highlighted above in green. This would delete all the mod entries as I am sure you know. I don't know if this could be done without knowing what the entries (mods) in between are right?

For example if I wanted the .bat file to delete ModManDescription you would have to actually write the entry "ModManDescription" in the .bat file, right? I mean is there a way to say, "No matter what appears inbetween InputZoomOutAlt and ModManDescription just get rid of it?"

It's no biggie to me to do it manually, I was just looking for an "Easy Button" as it were to save a tiny bit of time.

Thanks.
               
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.

MarkAnthony

#1
Hmmm, just thought of something after I shutdown the computer to go to bed so here I am again.

I guess I could just save (export) then entire Banished folder on the left to my desktop as it appears now with no mods installed. I guess that'll give me the same result since I don't change any of the game configurations now that I have them set as I want while playing.

So I guess a big "Never mind" is due.

Thanks anyhow.

EDIT: Hmmm, that actually didn't work. I exported that Banished folder to my desktop saving the state it was in with no mods installed. I then opened ModMan, selected a profile, loaded it, wrote the profile to the game registry and checked the registry. The mods were written to the registry. I then double-clicked the exported registry file on my desktop expecting it to replace everything but it didn't. All those mods that ModMan wrote to the registry were still listed.  I don't get what I am doing wrong or why it didn't work.

Any thoughts?

P.S.: It seems doing it this way wasn't a total "replace" of the Banished folder but more like "Add to it" as in "add whatever is in this registry file to whatever already exists" so since the mod names already existed when I double-clicked that registry file it just wrote around it all.

Seems like I might need a .bat file afterall maybe, ehh?

Edit Again: Okay, so how about this? A .bat file to delete the entire Banished folder? Then, when I double-click that exported Banished folder, it recreates it without the mods - just as I saved it?

Last Edit: Okay that worked. I manually deleted the entire Banished folder and then double-clicked my saved copy of it and it recreated the Banished folder with no mods in it.

So yeah, if someone can just tell me how to write the .bat file to delete the Banished folder I'll be all set.  It's been years since I made .bat files I honestly forgot how to code them.
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.

kid1293

#2
Hi @MarkAnthony - I just happen to have a .cmd-file for cleaning the registry.
I made it from dissecting another popular mod sorter. (the one by Gordon Dry)

It reads all Banished registry entries and writes back only your settings. Quick and easy.
Mod entries all empty. All settings preserved.

It leaves a .reg-file with the old entries. If you regret your cleaning you can double-click the BanishedExport.reg file.

Oh, one more. You have to run it as administrator. Right-click and 'Run as administrator'.


kid1293

I found the CMD-file also deletes the ModManInfo section. Is it a problem?

MarkAnthony

#4
Quote from: kid1293 on July 17, 2019, 06:00:12 AM
I found the CMD-file also deletes the ModManInfo section. Is it a problem?
I never had a ModManInfo part, just ModManDescription

Is that what you meant?

EDIT: Looking at ModManDescription it just seems to be the description of the last ModMan profile used. I wonder why it lists the description of the profile last used and not the actual name of the profile last used. Maybe @JM would clarify the purpose of that registry entry?

I see no harm in removing (or losing) ModManDescription either way because each actual ModMan profile description is saved in it's own .ini file within the ModMan install folder. I do not mind if ModMan opened up to my last used profile or not (if that was the purpose of the ModManDescription registry entry); opening up blank with no profile loaded is fine by me.

EDIT AGAIN: I see the .cmd file also tries to access registry entries for Banished in the HKEY Local Machine area too, not just HKEY Current User. I don't have registry entries under HKLM, only HKCU.

Is that bad? lol It's not my fault I don't have an HKLM Banished folder! I originally installed the game via Steam and then after really appreciating all Luke did with Banished bought it again, DRM-free. So, with two game installs I still don't have anything for Banished in HKLM.  /shrug

Now I got that ole FOMO feelin'  (fear of missing out) -- that makes me saaaad!  :(
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.

MarkAnthony

#5
Quote from: kid1293 on July 17, 2019, 06:00:12 AM
I found the CMD-file also deletes the ModManInfo section. Is it a problem?
What the hell, right! YOLO!  lol

I ran the .cmd file and yeah ModManDescription is what you meant, at least when I ran the .cmd file that is what got deleted when I checked Banished's registry.

All is good, this worked perfectly. Thank you @ brads3

Thank you @kid1293  <-- EDIT FOR MISTAKE:

Regards,

Mark

P.S.: Your ears must have been burning/itching/felt drawn to reply?  lol  That's because after work today I was going to send you a PM asking if you would assist me with something.   :P
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.

kid1293

No fear! I don't know why there should something in Local Machine. I kept it from Gordon Dry's check.
Maybe an old version of Banished? It is certainly not something you miss.

Of course, I mean ModManDescription. My fault.
And yes, it only stores the current ModMan description. Nothing important, I say.

A little hint. If you clear registry with my cmd-file you get a reg-file with the last setup.
Rename that to appropriate name (ie CC_PlusExtra.reg or something) and then you have a quick file
to double-click for each setup. ModMan handles that well. My way is maybe redundant and it leaves
mod registry clear. The first you have to do is double-click reg-file...  ::)

...and yes, brads3 is helpful but I am not him  ;)

MarkAnthony

Quote from: kid1293 on July 17, 2019, 07:52:10 AM
...and yes, brads3 is helpful but I am not him  ;)
OH SHIT!  ROFL   ??? :-[

Honestly, it's not an excuse but I did just wake up a few minutes before replying. I am so sorry. Your contribution to this thread topic was THE FINEST anyone could have done - absolutely NO ONE could have topped this!

LOL  *sighs I'm sorry @kid1293

Have a fantastic, AWESOME, Kid1293 kind of day!!!   :P

P.S.: And for what it's worth, I was gonna hit you up for something too hehe, I just haven't gotten that far yet.

/salute
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.

kid1293

111 F !! I wouldn't wake up at all!  ;D

Have a nice day you too! :)

MarkAnthony

Quote from: kid1293 on July 17, 2019, 08:03:51 AM
111 F !! I wouldn't wake up at all!  ;D

Have a nice day you too! :)
Yeah, hmmph! It's actually been hitting 113F-115F  the last few days!   >:( Not happy here! Got no a/c for me nor the pets.  :'(   *sighs* What a dump I live in.
Sometimes it's the very people who no one imagines anything of
        who do the things no one can imagine.