boyemillar Posted January 18, 2008 Posted January 18, 2008 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
weaponx Posted January 18, 2008 Posted January 18, 2008 (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 January 18, 2008 by weaponx
boyemillar Posted January 18, 2008 Author Posted January 18, 2008 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...
weaponx Posted January 18, 2008 Posted January 18, 2008 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.
boyemillar Posted January 18, 2008 Author Posted January 18, 2008 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
boyemillar Posted January 18, 2008 Author Posted January 18, 2008 Sorry my bad I had left an extra "\" at the end of the path
weaponx Posted January 18, 2008 Posted January 18, 2008 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."
boyemillar Posted January 18, 2008 Author Posted January 18, 2008 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.
Developers Jos Posted January 18, 2008 Developers Posted January 18, 2008 RunWait(@ComSpec & ' /c CACLS "c:\program files\{whatever}" /E /T /C /G "Domain Users":F','',@sw_hide) Is nicely explained in the Helpfile ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
weaponx Posted January 18, 2008 Posted January 18, 2008 (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 January 18, 2008 by weaponx
boyemillar Posted January 18, 2008 Author Posted January 18, 2008 Cheerz very much for the help peeps I will need to start reading the help files
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now