Bypass the cacls confirmation prompt automatically?
Solution 1:
I am prompted with the Y/N on each item
I would like to bypass this by automatically saying "yes" for each of these
You can pipe Y
into cacls
using echo
:
echo Y | cacls "%PROGRAMFILES%\WindowsApps" /grant Administrators:f
The
CACLS
command does not provide a/Y
switch to automatically answer'Y'
to theY/N
prompt. However, you can pipe the'Y'
character into theCACLS
command usingECHO
, use the following syntax:ECHO Y| CACLS filename /g username:permission
Source Cacls - Modify Access Control List - Windows CMD - SS64.com
Solution 2:
Use this syntax:
echo y| cacls.exe [options]...
Note that the command-line needs to be written exactly as above, including the blanks (see link).
Solution 3:
Switch to icacls.exe (built into Windows), which doesn't have this prompt.