-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
28 lines (23 loc) · 753 Bytes
/
Copy pathrun.bat
File metadata and controls
28 lines (23 loc) · 753 Bytes
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
@echo off
:: Set CWD to the script's directory
cd /d "%~dp0/fishtank"
:: Check for admin rights
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Requesting administrative privileges...
set args=%*
if defined args (
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Start-Process -FilePath '%~f0' -Verb RunAs -ArgumentList @('%args%')"
) else (
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Start-Process -FilePath '%~f0' -Verb RunAs"
)
exit
)
:: Unblock the script
powershell -Command "Unblock-File -Path run.ps1"
:: Run the PowerShell script with passed arguments
powershell -ExecutionPolicy Unrestricted -File run.ps1 %*
echo Script execution completed.
pause