-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsplit.cmd
More file actions
55 lines (45 loc) · 1.98 KB
/
split.cmd
File metadata and controls
55 lines (45 loc) · 1.98 KB
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
@echo off
:: Check for administrative privileges
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: The script is running with administrative privileges.
) else (
echo Failure: The script is not running with administrative privileges.
echo Requesting administrative privileges...
:: Elevate the script using PowerShell
powershell -Command "Start-Process cmd.exe -ArgumentList '/c ""%~s0""' -Verb RunAs"
:: Exit the non-elevated script
exit /b
)
:: Close BlueStacks Multi-Instance Manager
taskkill /IM "HD-MultiInstanceManager.exe" /F 2>NUL
taskkill /IM "HD-Player.exe" /F 2>NUL
taskkill /IM "BlueStacksHelper.exe" /F 2>NUL
taskkill /IM "BstkSVC.exe" /F 2>NUL
:: Get the installation path of BlueStacks from the registry
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks_nxt" /v "UserDefinedDir"') do set "defaultDirectory=%%~dpb"
echo %defaultDirectory%
:: Rename the defaultDirectory to rootDirectory and create a copy for noRootDirectory
set "rootDirectory=%defaultDirectory%BlueStacks_nxtRoot"
set "noRootDirectory=%defaultDirectory%BlueStacks_nxtNoRoot"
:: Check if the rootDirectory and noRootDirectory already exist
if exist "%rootDirectory%" (
echo The directory "%rootDirectory%" already exists.
pause
exit /b
)
if exist "%noRootDirectory%" (
echo The directory "%noRootDirectory%" already exists.
pause
exit /b
)
:: Change the permissions of the defaultDirectory and remove the read-only attribute
icacls "%defaultDirectory%BlueStacks_nxt" /grant Everyone:(OI)(CI)F /T
attrib -R "%defaultDirectory%BlueStacks_nxt\*.*" /S
:: Rename the defaultDirectory to rootDirectory
echo Renaming "%defaultDirectory%BlueStacks_nxt" to "%rootDirectory%"
ren "%defaultDirectory%BlueStacks_nxt" "BlueStacks_nxtRoot"
:: Copy the rootDirectory to noRootDirectory
echo Copying from "%rootDirectory%" to "%noRootDirectory%"
xcopy /E /I "%rootDirectory%" "%noRootDirectory%"
pause