Skip to content

Commit 9b4aeee

Browse files
committed
fix: enhance elevation process in Windows script for better user experience
- Updated the script to create a temporary VBS file for elevating permissions, improving the user experience during setup. - Added clear messaging to inform users about the elevation process and the behavior of the new window. - Ensured the temporary VBS file is deleted after execution to maintain a clean environment.
1 parent a313739 commit 9b4aeee

File tree

1 file changed

+6
-2
lines changed
  • apps/portal/src/app/api/download-agent/scripts

1 file changed

+6
-2
lines changed

apps/portal/src/app/api/download-agent/scripts/windows.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ if not %errorlevel%==0 (
3434
echo A prompt will appear asking for permission. Please click "Yes".
3535
echo If no prompt appears, right-click this file and select "Run as administrator".
3636
echo.
37-
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -Verb RunAs -FilePath '%comspec%' -ArgumentList '/k','\"%~f0\"' -WorkingDirectory '%cd%'"
38-
echo This window will now close. The setup will continue in the new window.
37+
echo Elevating... A new window will open and remain open after running.
38+
> "%TEMP%\getadmin.vbs" echo Set UAC = CreateObject^("Shell.Application"^)
39+
>> "%TEMP%\getadmin.vbs" echo UAC.ShellExecute "%~f0", "", "", "runas", 1
40+
wscript "%TEMP%\getadmin.vbs" >nul 2>&1
41+
del "%TEMP%\getadmin.vbs" >nul 2>&1
42+
echo This window will now close. The setup will continue in the new (admin) window.
3943
pause
4044
exit /b
4145
)

0 commit comments

Comments
 (0)