Link to home
Start Free TrialLog in
Avatar of John Darby
John DarbyFlag for United States of America

asked on

CMD shell elevation.js

Greetings,
I have a CMD which calls elevate.js to see if an elevated privilege is required for script execution. Can you help me understand how this works?

CMD script -->
<code>
@echo off
ECHO Checking if elevation is required to collect all logs...
IF X%1==XNoPause goto SkipElevation
cscript %~dp0\elevate.js %~dp0\Logging_Elevated.cmd
goto EOF
:SkipElevation
call %~dp0\Logging_Elevated.cmd %1 %2
:EOF
</code>

Thank you,
JohnD
elevate.js
Avatar of NVIT
NVIT
Flag of United States of America image

IF X%1==XNoPause goto SkipElevation

Open in new window


If the argument NoPause was not passed to this file, then jumps to :SkipElevation

cscript %~dp0\elevate.js %~dp0\Logging_Elevated.cmd
goto EOF

Open in new window


Run the Windows VBScript command processor, passing the elevate.js to it.

:SkipElevation
call %~dp0\Logging_Elevated.cmd %1 %2

Run Logging_Elevated.cmd, including arguments %1 and %2, if any was included in the original command, i.e. this file.
:EOF

Open in new window

Avatar of John Darby

ASKER

Is the argument NoPause related to the OS asking for elevation?
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!