Right-Click Context Menu Tweeks [Win7]

Discussion in 'Windows 7' started by chaddawkins, Sep 5, 2009.

  1. chaddawkins

    chaddawkins MDL Senior Member

    Sep 16, 2007
    344
    66
    10
    #1 chaddawkins, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
    Here are a couple old goodies compatible with Win7, by that i mean runs with administrator privileges

    Command Prompt Here
    Code:
    Windows Registry Editor Version 5.00
     
    [HKEY_CLASSES_ROOT\Directory\shell\runas]
    @="Command Prompt Here"
    [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    @="cmd.exe /s /k pushd \"%V\""
    

    Take Ownership of any File or Directory
    Code:
    Windows Registry Editor Version 5.00
     
    [HKEY_CLASSES_ROOT\*\shell\runas]
    @="Take Ownership"
    "NoWorkingDirectory"=""
    [HKEY_CLASSES_ROOT\*\shell\runas\command]
    @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
     
    [HKEY_CLASSES_ROOT\Directory\shell\runas]
    @="Take Ownership"
    "NoWorkingDirectory"=""
    [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
    "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
    
    Register DLL/OCX/AX
    Code:
    Windows Registry Editor Version 5.00
     
    [HKEY_CLASSES_ROOT\dllfile\shell]
    @="none"
    [HKEY_CLASSES_ROOT\dllfile\shell\runas]
    @="&Register"
    [HKEY_CLASSES_ROOT\dllfile\shell\runas\command]
    @="regsvr32.exe \"%1\""
     
     
    [HKEY_CLASSES_ROOT\ocxfile\shell]
    @="none"
    [HKEY_CLASSES_ROOT\ocxfile\shell\runas]
    @="&Register"
    [HKEY_CLASSES_ROOT\ocxfile\shell\runas\command]
    @="regsvr32.exe \"%1\""
     
     
    [HKEY_CLASSES_ROOT\axfile\shell]
    @="none"
    [HKEY_CLASSES_ROOT\axfile\shell\runas]
    @="&Register"
    [HKEY_CLASSES_ROOT\axfile\shell\runas\command]
    @="regsvr32.exe \"%1\""
    

    What entries do i need for UnRegister DLL/OCX/AX ?

    This doesn't work
    Code:
    [HKEY_CLASSES_ROOT\dllfile\Shell\UnRegister\command]
    @="regsvr32.exe /u \"%1\""
    
    Also, how would I go about having both Command Prompt Here & Take Ownership of any File or Directory because they both occupy
    [HKEY_CLASSES_ROOT\Directory\shell\runas]
    @=
    and
    [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    @=
     
  2. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,770
    1,101
    60
    #2 Mr Jinje, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
    Here is some I use for right-click My Computer


    Code:
    Windows Registry Editor Version 5.00
    
    ;--------------------------------------------------
    ;This is the Right_Click_Options.reg file
    ;--------------------------------------------------
    
    
    ;Adds Registry Editor right click of MY Computer
    [HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\regedit]
    @="Registry Editor"
    [HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\regedit\command]
    @="Regedit.exe"
    
    ;Adds Device Manager to right click of MY Computer
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr]
    @="Device Manager"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr\command]
    @="mmc.exe C:\\WINDOWS\\SYSTEM32\\devmgmt.msc"
    
    ;Adds Control Panel to right click of MY Computer
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Control Panel\command]
    @="rundll32.exe shell32.dll,Control_RunDLL"
    
    ;Adds LogOff to right click of MY Computer
    [HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Logoff\command]
    @="shutdown -l -f -t 5"
    
    ;Adds Reboot to right click of MY Computer
    [HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot\command]
    @="shutdown -r -f -t 5"
    
    ;Adds Shutdown to right click of MY Computer
    [HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Shutdown\command]
    @="shutdown -s -f -t 5"
     
  3. Catflap

    Catflap MDL Novice

    Aug 2, 2009
    19
    0
    0
    #3 Catflap, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017

    regsvr32.exe /u "%1"
     
  4. chaddawkins

    chaddawkins MDL Senior Member

    Sep 16, 2007
    344
    66
    10
    #4 chaddawkins, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
    (OP)
    if by that you mean
    Code:
    [HKEY_CLASSES_ROOT\axfile\Shell\UnRegister\command]
    @="regsvr32.exe /u "%1""
    
    then no, that doesn't work either
     
  5. Catflap

    Catflap MDL Novice

    Aug 2, 2009
    19
    0
    0
    #5 Catflap, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
    Just put what I typed none of the @=" at the beginning or the other quote " at the end
     
  6. twiz

    twiz MDL Senior Member

    Jul 30, 2009
    401
    1
    10
    #6 twiz, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
  7. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,770
    1,101
    60
    #7 Mr Jinje, Sep 5, 2009
    Last edited by a moderator: Apr 20, 2017
    Here is VBS file that will create blank text files of different file extentsions. These show up when you create new file via Right Click > New menu.
    Code:
    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.RegWrite "HKCR\.VBS\ShellNew\FileName","template.vbs"
    objShell.RegWrite "HKCR\.BAT\ShellNew\FileName","template.bat"
    objShell.RegWrite "HKCR\.CMD\ShellNew\FileName","template.cmd"
    objShell.RegWrite "HKCR\.SIF\ShellNew\FileName","template.sif"
    objShell.RegWrite "HKCR\.INI\ShellNew\FileName","template.ini"
    objShell.RegWrite "HKCR\.REG\ShellNew\FileName","template.reg"
    objShell.RegWrite "HKCR\.PS1\ShellNew\FileName","template.ps1"
    objShell.RegWrite "HKCR\.NFO\ShellNew\FileName","template.nfo"
    objShell.RegWrite "HKCR\.XML\ShellNew\FileName","template.xml"
    The Data Param pre-populates the .reg so I don't have to keep re-type it every time.

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\.reg]
    @="regfile"
    
    [HKEY_CLASSES_ROOT\.reg\ShellNew]
    "Data"="Windows Registry Editor Version 5.00"
     
  8. Francis Lui

    Francis Lui MDL Novice

    Jul 12, 2014
    1
    0
    0
    #8 Francis Lui, Jul 12, 2014
    Last edited by a moderator: Apr 20, 2017
    I found that User Account Control (UAC) was giving me a 0x80070005 "Access Denied" error when trying to right-click and run regsvr32.exe "%1" on Windows 8.1 Update.

    After some searching, I found that I could use Powershell to run it as an Administrator.

    Here is the modified *.reg file that uses Powershell so you can register and unregister DLLs, even when running under UAC:

    Code:
    Windows Registry Editor Version 5.00
     
    [HKEY_CLASSES_ROOT\dllfile\shell]
    @="none"
     
    [HKEY_CLASSES_ROOT\dllfile\shell\DllRegisterServer]
    @=""
     
    [HKEY_CLASSES_ROOT\dllfile\shell\DllRegisterServer\command]
    @="powershell -c start -verb runas regsvr32.exe \"%1\""
     
    [HKEY_CLASSES_ROOT\dllfile\shell\DllUnregisterServer]
     
    [HKEY_CLASSES_ROOT\dllfile\shell\DllUnregisterServer\command]
    @="powershell -c start -verb runas regsvr32.exe /u \"%1\""