ricky Posted August 18, 2011 Share Posted August 18, 2011 Hello, it's possible to code in autoit those information in this page : http://www.blogsdna.com/2159/how-to-take-ownership-grant-permissions-to-access-files-folder-in-windows-7.htm Thanks in advance for you help Link to comment Share on other sites More sharing options...
Bert Posted August 18, 2011 Share Posted August 18, 2011 yes you can. If you noticed they show a different way to do this with a context click. It involves modifying the registry and then context clicking on the file you want to take ownership of. It would be a simple matter then to make an adjustment to the reg file they provide you so one could use an AutoIt script to do what you have in mind. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
jazzyjeff Posted August 18, 2011 Share Posted August 18, 2011 To set permissions or take ownership of files/folders, I always use the program SetACL and embed that in my exe with FileInstall. Works better than xcalcs with file/folder inheritance. I can't remember why now though, but there was an article somewhere about it. Link to comment Share on other sites More sharing options...
UEZ Posted August 18, 2011 Share Posted August 18, 2011 (edited) Try this:;Coded by UEZ 2010 #RequireAdmin $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2") $file = FileOpenDialog("Select file to reset ownership from current user.", "", "(*.*)") If @error Then Exit $res = Set_OwnerShip($file) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $res = ' & $res & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Func Set_OwnerShip($file) $file = StringReplace($file, "\", "\\") Local $colItems, $colItem $colItems = $objWMIService.ExecQuery("Select * From CIM_DataFile Where Name = '" & $file & "'", "WQL", 0x30) If IsObj($colItems) Then For $objItem In $colItems $objItem.TakeOwnerShipEx Next Return 1 Else Return SetError(1, 0, 0) EndIf EndFuncOr try the command line subinacl from Microsoft.Br,UEZ Edited August 19, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Chimaera Posted August 18, 2011 Share Posted August 18, 2011 (edited) Couple of subinacl eg you will obviously need the subinacl exe to make this work $source = "your source dir" $subinacl = @WorkingDir & "\subinacl.exe" RunWait(@ComSpec & " /c " & $subinacl & " /subdirectories " & $source & "*.*" & " /setowner=" & @UserName) RunWait(@ComSpec & " /c " & $subinacl & " /subdirectories " & $source & "*.*" & " /grant=" & @UserName & "=f") and ive done attrib this way before If FileExists ( $source & "Perflogs") Then FileSetAttrib( $source & "Perflogs", "-H", 1) Edited August 18, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
ricky Posted August 19, 2011 Author Share Posted August 19, 2011 Thanks UEZ and Chimera, but norhing work on Windows 7!!! jazzyjeff : You have a function? Link to comment Share on other sites More sharing options...
ricky Posted August 19, 2011 Author Share Posted August 19, 2011 (edited) I can't change the title... How can I do that also to delete a registry key? Edited August 19, 2011 by ricky03 Link to comment Share on other sites More sharing options...
hannes08 Posted August 19, 2011 Share Posted August 19, 2011 Deleting a registry key: RegDelete() You might also try using icacls.exe (at least that's what I use for Windows Server 2008+) Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
ricky Posted August 29, 2011 Author Share Posted August 29, 2011 Nobody can help me ?@Hannes123 : do you have examples?Deleting a registry key: RegDelete()Sometimes it doesn't work, because I don't have the right and I use #requireadmin Link to comment Share on other sites More sharing options...
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