how to change the ACLs from c++?

前端 未结 3 1772
你的背包
你的背包 2020-12-09 07:26

How to change the ACLs from c++?

Can anyone help me to do the following from c++ without any confirmations:

cacls c:\\personal\\file.txt /d everyone
         


        
3条回答
  •  被撕碎了的回忆
    2020-12-09 07:34

    If you don't want to mess around with the API (i.e. SetNamedSecurityInfo), you might be able to bypass the prompt like so:

    echo y|cacls filename /d everyone
    

    Since echo is a builtin, to call that command line from your program, you'd probably have to run:

    cmd.exe /c echo y|cacls filename /d everyone
    

提交回复
热议问题