Jump to content

Recommended Posts

Posted

Anybody got any ideas on how to set permissions on a folder with AutoIT, i usually use the following command in batch files

CACLS c:\program files\{whatever} /E /T /C /G "Domain Users":F

Posted (edited)

RunWait('CACLS c:\program files\{whatever} /E /T /C /G "Domain Users":F')

- or -

RunWait(@ComSpec & ' /c CACLS c:\program files\{whatever} /E /T /C /G "Domain Users":F')

Edited by weaponx
Posted

RunWait('CACLS c:\program files\{whatever} /E /T /C /G "Domain Users":F')

- or -

RunWait(@ComSpec & ' /c CACLS c:\program files\{whatever} /E /T /C /G "Domain Users":F')

Tried both the above and it runs the CACLS command and the dos box runs very quickly and closes and looks like it is having a problem with the switch but most probably the "Domain Users":F part that is causing the problem and it doesnt set the permissions...

Posted

You probably need double quotes around file path with spaces:

$result = RunWait('CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F')

MsgBox(0,"",$result)

- or -

$result = RunWait(@ComSpec & ' /c CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F')

MsgBox(0,"",$result)

Most command line programs return 1 for SUCCESS whereas Autoit functions return 0 for SUCCESS.

Posted

You probably need double quotes around file path with spaces:

$result = RunWait('CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F')

MsgBox(0,"",$result)

- or -

$result = RunWait(@ComSpec & ' /c CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F')

MsgBox(0,"",$result)

Most command line programs return 1 for SUCCESS whereas Autoit functions return 0 for SUCCESS.

Cheerz

But, The above returns a result of 160

Posted

Mine returns 1332. And when I run the same code from the command line it says:

"No mapping between account names and security IDs was done."

Posted

Cheerz mines is running fine noo with the...

RunWait(@ComSpec & ' /c CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F')

Any ideas on a way to hide the resultant dos window.

Posted (edited)

RunWait(@ComSpec & ' /c CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F', @ScriptDir, @SW_HIDE)

Check out RunWait() in the help file.

EDIT: Milliseconds late.

Edited by weaponx

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
×
×
  • Create New...