How to Use CACLS.EXE in a Batch File

ID: Q135268


The information in this article applies to:

The CACLS.EXE command line utility does not provide a /Y switch that automatically answers with Y for Yes to the ARE YOU SURE? Y/N prompt. However, you can use the echo command to pipe the character Y as input to the ARE YOU SURE? Y/N prompt when you call CACLS.EXE in a batch file.

To programmatically answer with Yes to the ARE YOU SURE? Y/N prompt during batch file execution, use the following command line in your batch file:
echo y| cacls <filename> /g <username>:<permission>
NOTE: Do not type a space between the "y" and the pipe symbol (|), otherwise, CACLS.EXE fails to make the permission changes.

vertical bar


Additional query words: prodnt 3.50 3.51 bypass skip confirmation


Keywords          : ntgeneral nthowto 
Version           : 3.50 3.51
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: January 15, 1999