Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # A simple PowerShell script to backup Way of the Hunter save file
- # Twitter: @Kerbo_
- #
- # Set your Steam ID
- # How to find your Steam ID https://www.google.com/search?q=what+is+my+steam+id
- # or look at the folder name here %localappdata%\WayOfTheHunter\Saved\SaveGames\Account_xxxxxxxxxxx
- # and xxxxxxxxxxx is your Steam ID
- $steamID = CHANGEME
- # No changes needed below here
- Write-Host "Stable"
- $wothDir = $env:LOCALAPPDATA + "\WayOfTheHunter\Saved\SaveGames\Account_" + $steamID
- $dateString = $(get-date -f yyy-MM-dd_HH-mm)
- if (-Not (Test-Path -Path $wothDir)) {
- Write-Host "Error! Save file location not found: $wothDir" -ForegroundColor red
- Start-Sleep -Seconds 5
- exit
- }
- Push-Location $wothDir
- $backup = gci SaveData-2* | select -last 1
- $backup_hash = Get-FileHash $backup
- $wothSave = Get-Item SaveData.sav
- $wothSave_hash = Get-FileHash $wothSave
- #Write-Host "$backup : $backup_hash"
- #Write-Host "$wothSave : $wothSave_hash"
- if ( $backup_hash.Hash -eq $wothSave_hash.Hash ) {
- Write-Host "SaveData.sav matches latest backup, no backup needed" -ForegroundColor green
- } else {
- cp SaveData.sav SaveData-$dateString.sav
- $RET=$?
- if ($RET) {
- Write-Host "Copied SaveData.sav to SaveData-$dateString.db" -ForegroundColor yellow
- } else {
- Write-Host "Error! cp returned $RET" -ForegroundColor red
- }
- }
- Pop-Location
- # Beta
- Write-Host "Beta"
- $wothDir = $env:LOCALAPPDATA + "\WayOfTheHunter\Saved\SaveGames\Account_" + $steamID + "_development"
- $dateString = $(get-date -f yyy-MM-dd_HH-mm)
- if (-Not (Test-Path -Path $wothDir)) {
- Write-Host "Beta save folder not found, will not backup" -ForegroundColor green
- Start-Sleep -Seconds 5
- exit
- }
- Push-Location $wothDir
- $backup = gci SaveData-2* | select -last 1
- $backup_hash = Get-FileHash $backup
- $wothSave = Get-Item SaveData.sav
- $wothSave_hash = Get-FileHash $wothSave
- #Write-Host "$backup : $backup_hash"
- #Write-Host "$wothSave : $wothSave_hash"
- if ( $backup_hash.Hash -eq $wothSave_hash.Hash ) {
- Write-Host "SaveData.sav matches latest backup, no backup needed" -ForegroundColor green
- } else {
- cp SaveData.sav SaveData-$dateString.sav
- $RET=$?
- if ($RET) {
- Write-Host "Copied SaveData.sav to SaveData-$dateString.db" -ForegroundColor yellow
- } else {
- Write-Host "Error! cp returned $RET" -ForegroundColor red
- }
- }
- Pop-Location
- Start-Sleep -Seconds 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement