Hack Forums
[Shell] Add "Run with priority" to Context Menu - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Add "Run with priority" to Context Menu (/showthread.php?tid=6004769)



Add "Run with priority" to Context Menu - Emre_ - Sep 3, 2019

Add Run with priority to the context menu of .exe files to change the process priority of applications for processor resources in Windows 10.


Code
:: Add Run with priority to the context menu of .exe files to change the process priority of applications for processor resources in Windows 10.


@Echo Off & Cls

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

Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Add "Run with priority" to 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 add "HKCR\exefile\shell\Priority" /v "MUIVerb" /t REG_SZ /d "Run with priority" /f  >Nul
Reg.exe add "HKCR\exefile\shell\Priority" /v "SubCommands" /t REG_SZ /d "" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout" /ve /t REG_SZ /d "Realtime" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Realtime \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout" /ve /t REG_SZ /d "High" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /High \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout" /ve /t REG_SZ /d "Above normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /AboveNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout" /ve /t REG_SZ /d "Normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Normal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout" /ve /t REG_SZ /d "Below normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /BelowNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout" /ve /t REG_SZ /d "Low" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Low \"%%1\"" /f  >Nul


Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo            Adding "Run with priority" to Context Menu
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


:_RegRestore

Reg.exe delete "HKCR\exefile\shell\Priority" /f >Nul



Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo        Removing "Run with priority" from Context Menu  
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit



RE: Add "Run with priority" to Context Menu - Crimin4L - May 30, 2020

This didnt work for me the CMD wouldnt open when I clicked it.


RE: Add "Run with priority" to Context Menu - Emre_ - May 30, 2020

(May 30, 2020 04:28 AM)Crimin4L Wrote:  This didnt work for me the CMD wouldnt open when I clicked it.
Make sure there is no space name of the batch script name it as Run_with_priority.bat


RE: Add "Run with priority" to Context Menu - Crimin4L - May 30, 2020

(May 30, 2020 05:08 AM)Emre_ Wrote:  Make sure there is no space name of the batch script name it as Run_with_priority.bat

Yea nada, opens for a millisecond and then closes


RE: Add "Run with priority" to Context Menu - Emre_ - May 30, 2020

Oh my bad here is the new script.


Code
:: Add Run with priority to the context menu of .exe files to change the process priority of applications for processor resources in Windows 10.


@Echo Off & Cls

(Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B)

Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Add "Run with priority" to 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 add "HKCR\exefile\shell\Priority" /v "MUIVerb" /t REG_SZ /d "Run with priority" /f  >Nul
Reg.exe add "HKCR\exefile\shell\Priority" /v "SubCommands" /t REG_SZ /d "" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout" /ve /t REG_SZ /d "Realtime" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Realtime \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout" /ve /t REG_SZ /d "High" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /High \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout" /ve /t REG_SZ /d "Above normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /AboveNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout" /ve /t REG_SZ /d "Normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Normal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout" /ve /t REG_SZ /d "Below normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /BelowNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout" /ve /t REG_SZ /d "Low" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Low \"%%1\"" /f  >Nul


Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo            Adding "Run with priority" to Context Menu
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


:_RegRestore

Reg.exe delete "HKCR\exefile\shell\Priority" /f >Nul



Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo        Removing "Run with priority" from Context Menu  
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit



RE: Add "Run with priority" to Context Menu - Emre_ - May 30, 2020

Oh my bad here is the new script.


Code
:: Add Run with priority to the context menu of .exe files to change the process priority of applications for processor resources in Windows 10.


@Echo Off & Cls

(Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B)

Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Add "Run with priority" to 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 add "HKCR\exefile\shell\Priority" /v "MUIVerb" /t REG_SZ /d "Run with priority" /f  >Nul
Reg.exe add "HKCR\exefile\shell\Priority" /v "SubCommands" /t REG_SZ /d "" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout" /ve /t REG_SZ /d "Realtime" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\001flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Realtime \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout" /ve /t REG_SZ /d "High" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\002flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /High \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout" /ve /t REG_SZ /d "Above normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\003flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /AboveNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout" /ve /t REG_SZ /d "Normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\004flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Normal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout" /ve /t REG_SZ /d "Below normal" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\005flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /BelowNormal \"%%1\"" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout" /ve /t REG_SZ /d "Low" /f  >Nul
Reg.exe add "HKCR\exefile\Shell\Priority\shell\006flyout\command" /ve /t REG_SZ /d "cmd.exe /c start \"\" /Low \"%%1\"" /f  >Nul


Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo            Adding "Run with priority" to Context Menu
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


:_RegRestore

Reg.exe delete "HKCR\exefile\shell\Priority" /f >Nul



Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo        Removing "Run with priority" from Context Menu  
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit