Skip to content

Instantly share code, notes, and snippets.

@Leayal
Last active July 6, 2019 11:54
Show Gist options
  • Save Leayal/7e086c7a521b46bffb8a8ccb56622784 to your computer and use it in GitHub Desktop.
Save Leayal/7e086c7a521b46bffb8a8ccb56622784 to your computer and use it in GitHub Desktop.
WeMade's SoulWorker Set GameFolder (Windows Batch script)
@echo OFF
SETLOCAL
:: Check if the batch is in the game folder
IF NOT EXIST "%~dp0SoulWorker100.exe" (
echo/Please put this file next to the file "SoulWorker100.exe". I mean: Put this file in your game folder.
pause>nul
exit
)
:: Acquire current folder and remove the slash at the end of the string
SET "CURRENT_ROOT=%~dp0"
SET "CURRENT_ROOT_WITHOUT_SLASH=%CURRENT_ROOT:~0,-1%"
:: Check if the batch is running as admin or not. Writing to HKEY_LOCAL_MACHINE requires admin.
net session >nul 2>&1
if %errorLevel% == 0 (
:: Writing registry. "/reg:32" imply redirect the key to "WOW6432Node" if the operating system is 64-bit, otherwise no redirection
reg add "HKLM\SOFTWARE\WeMade Online\Soulworker" /v Execute /t REG_SZ /d "%CURRENT_ROOT_WITHOUT_SLASH%\soulworker100.exe" /reg:32 /f > nul
reg add "HKLM\SOFTWARE\WeMade Online\Soulworker" /v InstallPath /t REG_SZ /d "%CURRENT_ROOT_WITHOUT_SLASH%" /reg:32 /f > nul
echo Success: The WGLauncher should recognize this directory now.
) else (
echo Failure: Administrative permission is required to write registry data to [HKEY_LOCAL_MACHINE].
echo Please run this script as admin. If you don't trust this script, use the .reg file method.
)
ENDLOCAL
echo.
echo Press any keys to close.
pause >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment