diff --git a/sin-setup.bat b/sin-setup.bat index 88ca4da..1d7f8b8 100644 --- a/sin-setup.bat +++ b/sin-setup.bat @@ -1,27 +1,22 @@ @echo off set mypath=%~dp0 +set rights_admin=0 :: Check admin rights - NET SESSION >nul 2>&1 + IF NOT %ERRORLEVEL% EQU 0 ( - echo ######## ######## ######## ####### ######## - echo ## ## ## ## ## ## ## ## ## - echo ## ## ## ## ## ## ## ## ## - echo ###### ######## ######## ## ## ######## - echo ## ## ## ## ## ## ## ## ## - echo ## ## ## ## ## ## ## ## ## - echo ######## ## ## ## ## ####### ## ## + echo ####### Running as a regular user ######### + echo # The Wi-Fi profiles will be installed # + echo # for the current user. # + echo # Run as administrator to install them # + echo # for all users. # + echo ########################################### echo. - echo. - echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED ######### - echo This script must be run as administrator to work properly! - echo If you're seeing this after clicking on a start menu icon, then right click on the shortcut and select "Run As Administrator". - echo ########################################################## - echo. - PAUSE - EXIT /B 1 + pause +) ELSE ( + set rights_admin=1 ) @@ -56,8 +51,12 @@ goto main :setup_wifi cls -netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka.xml" -netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka 5G.xml" +set cmd_user=current +IF %rights_admin% EQU 1 ( + set cmd_user=all +) +netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka.xml" user=%cmd_user% +netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka 5G.xml" user=%cmd_user% echo.