auto agree in using CACLS Command + Answer [solved]

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

auto agree in using CACLS Command + Answer [solved]

#1 Post by abc0502 » 29 Oct 2011 01:39

i'm making 2 batch files to lock and unlock a folder using Cacls command like that:
The lock batch:

Code: Select all

cacls c:\myfolder /d Admin-PC


The Unlock batch:

Code: Select all

cacls c:\myfolder /P Admin-PC:F


i want to put that command in the patch file but it ask for yes or no
is there a way to put the answer with the command so i don't have to answer the question every time ... thanks
Last edited by abc0502 on 12 Mar 2012 00:34, edited 2 times in total.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: The Answer is Very Easy

#2 Post by abc0502 » 29 Oct 2011 02:10

OK ... I found the Answer for that question in http://situsnya.wordpress.com/2008/08/31/caclsexe-display-or-modify-access-control-lists-acls-for-files-and-folders/

the batch file should look like that: (lock)

Code: Select all

@echo off
cls
echo Y| cacls c:\myfolder /d Admin-PC


the CACLS command doesn't come with the /Y option so we write the Y using ECHO

the Unlock Batch file:

Code: Select all

@echo off
cls
echo Y| cacls c:\myfolder /P Admin-PC:F

:D :lol:

Post Reply