Jump to content

CACLS in Autoit


Keniger
 Share

Recommended Posts

Hi guys !

RunWait("cmd.exe /c " & "wmic USERACCOUNT get Name >"&@DesktopDir&"\users.txt",@ScriptDir,@SW_HIDE)

This little command save all users names on computer to file. Then ! I wrote script wich use that names to give permissions (Folders/Files)

$file0 = @DesktopDir & "\lol.txt"
$file = FileOpen("users.txt", 0)
$user1 = FileReadLine($file, 2)
RunWait("cmd.exe /c" & "cacls " & $file0 & " " & "/grant " & $user1 & ":(R)")
FileClose($file)

Wich should get this f**king permission to that file (R = only read and see)

If i write that command in cmd manually works -,- but in autoit nope... what is wrong here ?

This command in autoit looks like that :

cacls file_patch /grant user_name:® so what ... This should work but nope...

Sr for my english if bad xd

@@@@@@@@@@@@@@@@@@@@@@EDIT

Ooops ! Sorry for bad section !

Edited by Keniger
Link to comment
Share on other sites

Are you sure the command is correct? Here (WIndows 7) the syntax (according to the help file) is:

RunWait("cmd.exe /c" & "cacls " & $file0 & " " & "/G " & $user1 & ":R")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Add

#RequireAdmin
at the top of your script and use Run to execute Cacls.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If you try something and it doesn't work, please don't post "it doesn't work" but the return value of the function in error and the value of @error and @extended.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Ye, cmd runs with admin but its only illusion because command dont work right...

If I run CMD : Start > Acessories > Command Prompt > PPM Run As Admin Command work... Idk what is going on ;x

Posted Image

Only manualy works, with au3 nope :D WTF Is going on ? How I can run cmd as admin ?

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@EDIT

Okay I solved the problem :D I used "icacls" then I try with "cacls" and work ! How I can

Edited by Keniger
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...