Introduction

The right-click context menu in the Start menu provides quick access to several administrative tools. To restrict access for specific user accounts, you can deny read permissions to the relevant WinX folders using the icacls command in a batch script.

Batch Script to Hide Right-Click Options

The following batch script denies read permissions for the specified user account on the Group2 and Group3 folders, effectively hiding the right-click options in the Start menu:

@echo off
REM Define the user account to restrict
set "UserAccount=CompteUser"

REM Deny read permissions to the Group2 and Group3 folders
icacls.exe "C:\Users\Default\Appdata\Local\Microsoft\Windows\Winx\Group2" /deny %UserAccount%:r
icacls.exe "C:\Users\Default\Appdata\Local\Microsoft\Windows\Winx\Group3" /deny %UserAccount%:r

REM Output completion message
echo Right-click options hidden for %UserAccount%
pause

Script Explanation

  1. Define the user account: Sets the user account variable (CompteUser) to restrict.
  2. Deny read permissions: Uses icacls.exe to deny read permissions to the Group2 and Group3 folders for the specified user account.
  3. Output completion message: Displays a message indicating that the script has completed.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.