But as an administrator.
The CNS \ command of the MPR already will create any needed shortcut, but this does not run "as administrator" currently.
So we create a link with the command CNS\ and then patch this link so that the link starts the program "as administrator".
For this we change the byte 22 in which we set the bit 6 (dec 32).
For this we use the new "BIT" command of the MPR.
Code: Select all
'#EXE:?path
'#SPI:AutoSettings
'#FDC:Ask
'#MAN:ra
'
KRM\2
VAR\$$NAM=?path\Mybat
VAR\$$TAP=$$NAM.bat
' 1. Create a batch file
VAR\$$TXA=@ECHO OFF$crlf$REM *** User should run this batch in order to execute a batch "as Administrator"
DEL\$$TAP
CTF\$$TAP<$$TXA
' 2. Create the Shortcut (Link) for this batch file
VAR\$$NAL=$$NAM.lnk
CNS\$$NAM|$$TAP
' Nun setzen wir das "Run as Admin Flag"
IEF\$$NAL
CFF\$$NAL>$$NAI
ELSE
MBX\Error Link does not exist.
@
EEF\
GSL\$$NAI>$$LEN
GSS\1,21|$$NAI>$$PAA
GSS\22,22|$$NAI>$$PAB
GSS\23,0|$$NAI>$$PAC
ASC\$$PAB>$$PAN
' Bit 6 in Byte 22 setzen (32)
BIT\set|$$PAN|6>$$PAN
CHR\$$PAN>$$PAB
VAR\$$OUT=$$PAA$$PAB$$PAC
DEL\$$NAL
MBX\!
CTF\$$NAL<$$OUT
@
With our option "as Admin" it was the byte 22. But which byte belongs to which option?
You can figure that out yourself. Take the shortcut and just make a copy of it.
Now you manually make the desired change to the copy.
The following script will show the difference between the original and the modified shortcut.
Here it is the byte 22, which changes from 0 to 32.
The idea comes from here:
Der Admin Patch
Code: Select all
KRM\2
VAR\$$FIA=?path\Shortcut A.lnk
VAR\$$FIB=?path\Shortcut B.lnk
CFF\$$FIA>$$CIA
CFF\$$FIB>$$CIB
GSL\$$CIA>$$LEA
GSL\$$CIB>$$LEB
IVV\$$LEA!$$LEB
MBX\Len not equal!
'ELSE
' MBX\LEN=$$LEA
EVV\
FOR\$$IND|1|$$LEA
GSS\$$IND,$$IND|$$CIA>$$BYA
GSS\$$IND,$$IND|$$CIB>$$BYB
IVV\$$BYA!$$BYB
ASC\$$BYA>$$AYA
ASC\$$BYB>$$AYB
MBX\$$IND--$$AYA!$$AYB
EVV\
NXT\
@