From dc918c4e42e0e3e13d728abc1dcbe512411ac9dd Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 11 Feb 2020 11:57:24 -0800 Subject: [PATCH] Do not elevate unless necessary 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 --- bin/elevate.cmd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/elevate.cmd b/bin/elevate.cmd index ba1bf4b..e168318 100644 --- a/bin/elevate.cmd +++ b/bin/elevate.cmd @@ -1,5 +1,12 @@ @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" %*