Skip to content

Commit

Permalink
script formatting and typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Sep 5, 2018
1 parent 6a87516 commit 798c427
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
13 changes: 9 additions & 4 deletions HeroesShareUninstall.bat
Expand Up @@ -4,29 +4,34 @@ echo Uninstalling for %USERNAME%
echo.

echo Checking for and removing existing tasks
echo .
echo.

schtasks /query /tn HeroesShareWatcher > NUL 2>&1
if %ERRORLEVEL% EQU 1 goto Check1

echo Removing existing watcher task...
@echo on
schtasks /end /tn HeroesShareWatcher
schtasks /delete /f /tn HeroesShareWatcher
@echo off

:Check1

schtasks /query /tn HeroesShareUpdater > NUL 2>&1
if %ERRORLEVEL% EQU 1 goto Check1
if %ERRORLEVEL% EQU 1 goto Check2

echo Removing existing updater task...
@echo on
schtasks /end /tn HeroesShareUpdater
schtasks /delete /f /tn HeroesShareUpdater
@echo off

:Check2

echo Removing application directory...
if exist "%APPDATA%\Heroes Share\" rmdir /s /q "%APPDATA%\Heroes Share\"

echo.

@echo off
timeout /t 30 > NUL
echo Complete! Quitting in 30 seconds
timeout /t 30 > NUL
23 changes: 16 additions & 7 deletions Setup.bat
Expand Up @@ -4,23 +4,29 @@ echo Installing for %USERNAME%
echo.

echo Checking for and removing existing tasks
echo .
echo.

schtasks /query /tn HeroesShareWatcher > NUL 2>&1
if %ERRORLEVEL% EQU 1 goto Check1

echo Removing existing watcher task...

@echo on
schtasks /end /tn HeroesShareWatcher
schtasks /delete /f /tn HeroesShareWatcher
@echo off

:Check1

schtasks /query /tn HeroesShareUpdater > NUL 2>&1
if %ERRORLEVEL% EQU 1 goto Check1
if %ERRORLEVEL% EQU 1 goto Check2

echo Removing existing updater task...

@echo on
schtasks /end /tn HeroesShareUpdater
schtasks /delete /f /tn HeroesShareUpdater
@echo off

:Check2

Expand All @@ -29,22 +35,25 @@ if not exist "%APPDATA%\Heroes Share\" mkdir "%APPDATA%\Heroes Share\"
echo.

echo Copying files...

@echo on
copy /y "%~dp0rejoinprotocol.exe" "%APPDATA%\Heroes Share\"
copy /y "%~dp0watcher.ps1" "%APPDATA%\Heroes Share\"
copy /y "%~dp0updater.ps1" "%APPDATA%\Heroes Share\"
copy /y "%~dp0version.txt" "%APPDATA%\Heroes Share\"

@echo off
echo.

echo.

:Check3
echo Creating the scheduled tasks

@echo on
schtasks /create /np /tn HeroesShareWatcher /xml "%~dp0WatcherTask.xml"
schtasks /create /np /tn HeroesShareWatcher /xml "%~dp0UpdaterTask.xml"

schtasks /create /np /tn HeroesShareUpdater /xml "%~dp0UpdaterTask.xml"
@echo off
timeout /t 30 > NUL

echo.

echo Complete! Quitting in 30 seconds
timeout /t 30 > NUL
2 changes: 1 addition & 1 deletion updater.ps1
Expand Up @@ -56,7 +56,7 @@ $TmpFile = New-TemporaryFile
$client = New-Object System.Net.WebClient
$client.DownloadFile("https://heroesshare.net/clients/update/win", $TmpFile)

Write-Output "Download complete: $TmpFile"
Write-Output "Download complete: $TmpFile" | LogLine

# Get correct hash from website
$Hash = Invoke-RestMethod -Uri "https://heroesshare.net/clients/hash/win"
Expand Down

0 comments on commit 798c427

Please sign in to comment.