-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.bat
83 lines (61 loc) · 1.64 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@echo off
setlocal
rem Change the current working directory to the script's directory
cd /d "%~dp0"
rem set variables
set "bmPluginsFolder=%APPDATA%\bakkesmod\bakkesmod\plugins"
set "dllFile=%~dp0RandomCommand.dll"
set "cfgFolder=%APPDATA%\bakkesmod\bakkesmod\cfg"
rem ----------- Copy .dll file to bakkesmod plugins folder -----------
rem Check if the source folder exists before attempting to copy
if not exist "%bmPluginsFolder%" (
echo.
echo.
echo Error: Destination folder does not exist: "%bmPluginsFolder%"
echo.
echo.
echo Press any key to exit...
echo.
timeout /t 10 >nul 2>&1
exit /b 1
)
rem Use xcopy to copy the file to the destination folder
xcopy "%dllFile%" "%bmPluginsFolder%" /Y
rem Check the exit code of xcopy and handle any errors if needed
if errorlevel 1 (
echo.
echo.
echo Error occurred while copying .dll file to bakkesmod plugins folder.
echo.
echo .... maybe try running as Administrator?
echo.
echo.
echo Press any key to exit...
echo.
timeout /t 10 >nul 2>&1
exit /b 1
) else (
echo PLugin .dll file successfully copied to "%bmPluginsFolder%"
)
rem ----------- Add line: plugin load randomcommand to plugins.cfg -------------
cd /d %cfgFolder%
set "newLine=plugin load randomcommand"
echo %newLine% | findstr /G:plugins.cfg > nul
IF %ERRORLEVEL% EQU 0 (
echo Line already found in .cfg file...
) ELSE (
echo %newLine% >> "plugins.cfg"
echo Successfully added line to plugins.cfg
)
echo.
echo.
echo.
echo.
echo.
echo Setup successfully completed.
echo.
echo.
echo Press any key to exit...
echo.
timeout /t 20 >nul 2>&1
endlocal