Jump to content

KSP Refresher (batch script, need halp)


KFS

Recommended Posts

Okay, so im a person who plays with a heavy amount of mods installed, for me eventually after a while of so many crashing, the actual stock ksp files get corrupted/broken, and cause more crashes. So im working on a very simple script, what i did was take my original totally mod free version of ksp .22 and put it into its own zip file. I wanted to make it so you could modify it without too much trouble for your own setup, or add a prompt to ask you where youd like the backup.



Directory of C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program
\22

12/31/2013 09:25 AM <DIR> .
12/31/2013 09:25 AM <DIR> ..
12/31/2013 09:25 AM <DIR> Kerbal Space Program 0.22
12/19/2013 12:27 AM 488,906,387 Kerbal Space Program 0.22.zip
12/31/2013 09:15 AM <DIR> postdata
1 File(s)
4 Dir(s)

The directory structure is confusing, so i will explain the variables here.

dest=C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\

Is the location of the top most directory in this install. Its a subdirectory of my steam updated ksp.

postdest=C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\"Kerbal Space Program 0.22"\"Kerbal Space Program"\

Is the full path of KSP.22 in this case. (gamedata, ksp.exe are in here)

C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\postdata\

Is where the backup is made to, gamedata, saves, ships, resources and plugins are all saved.



Directory of C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program
\22\postdata

12/31/2013 09:15 AM <DIR> .
12/31/2013 09:15 AM <DIR> ..
12/31/2013 09:26 AM <DIR> GameData
12/31/2013 09:14 AM <DIR> Parts
12/31/2013 09:14 AM <DIR> Plugins
12/31/2013 09:15 AM <DIR> saves
12/31/2013 09:15 AM <DIR> Screenshots
12/31/2013 09:15 AM <DIR> Ships
0 File(s)
8 Dir(s)

The basic idea of its usage is like so:

1. Backup user modifications(mods, saves, ships, resources)

2. Delete ksp, all of it.

3. Restore KSP

4. Restore mods

5. ????????????

6. Profit!


@echo off
rem ##############################
rem this script does not work yet
rem ##############################
title KSP Refresher 0.1
cls
set 7zip=C:\"Program Files"\7-Zip\7z.exe
set dest=C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\
set postdest=C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\"Kerbal Space Program 0.22"\"Kerbal Space Program"\
set predest=C:\"Program Files (x86)"\Steam\SteamApps\common\"Kerbal Space Program"\22\"Kerbal Space Program 0.22"\
set zip=%dest%"Kerbal Space Program 0.22.zip"
echo Performing Precleaning..
rd /S /Q %dest%postdata\
mkdir %dest%postdata
mkdir %postdest%postdata\GameData\
echo D | xcopy %postdest%GameData %dest%postdata\GameData\ /S
echo y | del /f %postdest%GameData\Squad\
mkdir %dest%postdata\Parts\
echo D | xcopy %postdest%Parts %dest%postdata\Parts\ /S
mkdir %postdest%PluginData\
echo D | xcopy %postdest%PluginData %dest%postdata\PluginData\ /S
mkdir %postdest%/Plugins\
echo D | xcopy %postdest%Plugins %dest%postdata\Plugins\ /S
mkdir %postdest%Resources\
echo D | xcopy %postdest%Resources %dest%postdata\Resources\ /S
mkdir %postdest%postdata\saves\
echo D | xcopy %postdest%saves %dest%postdata\saves /S
mkdir %postdest%Screenshots
echo D | xcopy %postdest%Screenshots %dest%postdata\Screenshots /S
mkdir %postdest%Ships
echo D | xcopy %postdest%Ships %dest%postdata\Ships /S
cls
echo Preclean and backup ready, beginning wipe...
rd /S /Q %predest%
%7zip% x %zip%

Backup works perfectly, i just cannot seem to delete KSP.... Windows 8. Once i get this working on windows i can easily make mac and linux versions, i know bash much better than i do batch.

Edited by KFS
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...