mirror of
https://github.com/coreybutler/nvm-windows.git
synced 2025-09-03 11:15:54 +00:00

This changes `elevate.cmd` to first try to execute the requested command *without* elevation. If the command failed (i.e., `ERRORLEVEL` was non-zero), then retry the command with elevation. Fixes #510
13 lines
305 B
Batchfile
13 lines
305 B
Batchfile
@setlocal
|
|
@echo off
|
|
|
|
:: Try without elevation, in case %NVM_SYMLINK% is a user-owned path and the
|
|
:: machine has Windows 10 Developer Mode enabled
|
|
%*
|
|
if %ERRORLEVEL% LSS 1 goto :EOF
|
|
|
|
:: The command failed without elevation, try with elevation
|
|
set CMD=%*
|
|
set APP=%1
|
|
start wscript //nologo "%~dpn0.vbs" %*
|