Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Add 'Run as administrator' to PS1 File Context Menu in Windows 10

Code
:: How to Add 'Run as administrator' to PS1 File Context Menu in Windows 10

@Echo Off


net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)

Cls & Mode CON  LINES=11 COLS=75 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo        Add Run as administrator to PS1 File Context Menu (Y/N)?  
Echo.      
Echo.
Echo.


Set /p input= RESPONSE:

If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start)

:_Ex
If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)



:_Start

Reg.exe delete "HKCR\Microsoft.PowerShellScript.1\Shell\runas" /f > Nul
Reg.exe add "HKCR\Microsoft.PowerShellScript.1\Shell\runas" /v "HasLUAShield" /t REG_SZ /d "" /f > Nul
Reg.exe add "HKCR\Microsoft.PowerShellScript.1\Shell\runas\command" /ve /t REG_SZ /d "powershell \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%%1'\"" /f > Nul


Cls & Mode CON  LINES=11 COLS=40 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo           Adding Context Menu  
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


:_RegRestore

Reg.exe delete "HKCR\Microsoft.PowerShellScript.1\Shell\runas" /f > Nul



Cls & Mode CON  LINES=11 COLS=40 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo        Removing Context Menu  
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by iRazorOct 15, 2021 12:35 PM 3 156 Oct 15, 2021 12:35 PM
Last Post: steel iron
[Shell] by Emre_Jan 12, 2021 11:16 PM 0 140 Jan 12, 2021 11:16 PM
Last Post: Emre_
[C#] by gigajewJun 17, 2020 01:03 PM 18 3,073 Jun 17, 2020 01:03 PM
Last Post: Freak_OG