- Thread Author
-
- #1
I would like to add a new item for Directories to the WinExplorer context menu.
In former WInXP I simply add the following Registry entry:
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdPrompt\command]
@="D:\\specialprog\\batchlog \"%1\""
However: This command is not recognized (for normal users) in Win7.
Why?
Furthermore (in der next step!!!) this entry should only be runnable as administrator.
Where EXACTLY should I put this command in Registry so that it cannot be run as normal user but as administrator
Peter
In former WInXP I simply add the following Registry entry:
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdPrompt\command]
@="D:\\specialprog\\batchlog \"%1\""
However: This command is not recognized (for normal users) in Win7.
Why?
Furthermore (in der next step!!!) this entry should only be runnable as administrator.
Where EXACTLY should I put this command in Registry so that it cannot be run as normal user but as administrator
Peter
Solution
To add a new item to the Windows Explorer context menu for directories and restrict its execution to only be allowed for administrators in Windows 7, you need to make modifications to the Windows Registry. However, there are a few considerations to keep in mind:
- Windows Vista and later versions introduced User Account Control (UAC), which restricts administrative privileges. This means that even if a user account is part of the Administrators group, the commands are not automatically run with elevated privileges unless explicitly requested.
- Running the context menu entry as an administrator would require UAC elevation.
Steps to Create a Elevated Context Menu Entry for Directories:
- Navigate to the Registry...
- Joined
- Mar 14, 2023
- Messages
- 95,408
To add a new item to the Windows Explorer context menu for directories and restrict its execution to only be allowed for administrators in Windows 7, you need to make modifications to the Windows Registry. However, there are a few considerations to keep in mind:
- Windows Vista and later versions introduced User Account Control (UAC), which restricts administrative privileges. This means that even if a user account is part of the Administrators group, the commands are not automatically run with elevated privileges unless explicitly requested.
- Running the context menu entry as an administrator would require UAC elevation.
Steps to Create a Elevated Context Menu Entry for Directories:
- Navigate to the Registry Editor:
- Press
Win + Rto open the "Run" dialog. - Type
regeditand press Enter to open the Registry Editor.
- Navigate to the following Registry key:
Code:
HKEY_CLASSES_ROOT\Directory\shell - Create a new key under
shell. Name it according to your preference, such asOpenCmdPromptAdmin. - Inside the newly created key, create a new key named
command. - Set the default value of the
commandkey to the path of the executable or script you want to run with elevated privileges.
- To enforce running the command with administrative privileges, you can use a tool like
runasto elevate the command prompt. - Update the default value of the
commandkey to includerunas /user:Administratorbefore the command to ensure it runs as an administrator.Example Registry Entry:
Here is an example of how the Registry entry for the context menu item might look:Code:HKEY_CLASSES_ROOT\Directory\shell\OpenCmdPromptAdmin\command @="runas /user:Administrator D:\\specialprog\\batchlog \"%1\""Important Note:
Always exercise caution when making changes to the Windows Registry, as incorrect modifications can cause system issues. Make sure to back up the Registry before making any changes. After creating this entry, when a regular user tries to access this context menu item, they will be prompted for administrator credentials to run the command with elevated privileges.
- Press
Similar threads
- Solved
- Replies
- 2
- Views
- 2K