avery Posted April 9, 2008 Share Posted April 9, 2008 (edited) Several times I've attempted to do something I would consider very simple. I'm trying to copy a scripts.ini file to the GroupPolicy\User folder as admin. FileCopy("C:\proj\au3\scripts.ini", "C:\WINDOWS\system32\GroupPolicy\User\Scripts\scripts.ini") ; This fails However this next one works just fine. FileCopy("C:\proj\au3\scripts.ini", "C:\proj\au3\scripts2.ini") ; Bingo! I'm running all this as admin and I've used the attrib -H command on the folder but it still shows hidden in File Explorer. This is very confusing to me please advise. btw I love au3 so far, having lots of fun until getting stuck now edit: I just tried more things with no luck. Run(@ComSpec & ' /k attrib -H -S -R C:\WINDOWS\system32\GroupPolicy') Run(@ComSpec & ' /k attrib C:\WINDOWS\system32\GroupPolicy') FileInstall("C:\proj\tmp\test.txt", "C:\WINDOWS\system32\GroupPolicy\test.txt") ; Fails It seems to be some permissions on GroupPolicy folder I just can't figure out Edited April 9, 2008 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
monoceres Posted April 9, 2008 Share Posted April 9, 2008 (edited) You need to create the directory first, DirCreate("C:\WINDOWS\system32\GroupPolicy\User\") Edit: now I saw that you couldn't even write to GroupPolicys, try making yourself the owner of the dir Edited April 9, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
avery Posted April 9, 2008 Author Share Posted April 9, 2008 You need to create the directory first, DirCreate("C:\WINDOWS\system32\GroupPolicy\User\") Edit: now I saw that you couldn't write to GroupPolicys, try making yourself the owner of the dirThanks.I have all those directories already and I bet you do too. They are Default Windows folders that GroupPolicy information is stored in, run gpedit.msc.Can you see if these commands work for you and your folder: C:\WINDOWS\system32\GroupPolicy\Machine\Scripts Also User\Scripts www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
avery Posted April 9, 2008 Author Share Posted April 9, 2008 I am full admin. I can right click and add folders/files just not w/ au3 so far www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
monoceres Posted April 9, 2008 Share Posted April 9, 2008 Thanks.I have all those directories already and I bet you do too. They are Default Windows folders that GroupPolicy information is stored in, run gpedit.msc.Can you see if these commands work for you and your folder: C:\WINDOWS\system32\GroupPolicy\Machine\Scripts Also User\ScriptsNope I don't, my GroupPolicy folder is empty. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
avery Posted April 9, 2008 Author Share Posted April 9, 2008 Nope I don't, my GroupPolicy folder is empty.That is ok. Try to use FileCopy and copy from a tmp folder into it and see if it errors please www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
monoceres Posted April 9, 2008 Share Posted April 9, 2008 I tried your above script and it worked, running on Vista btw. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
avery Posted April 10, 2008 Author Share Posted April 10, 2008 That is odd. I have two separate computers. My computer at work and my laptop at home both running XP pro. I can't see to copy anything with au3 into a Hidden system folder like GroupPolicy. The SetAttr commands in au3 are not working on those types of folders either. I will try it on a fresh install at work tomorrow but I get a feeling it's a bug. www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2008 Moderators Share Posted April 10, 2008 That is odd. I have two separate computers. My computer at work and my laptop at home both running XP pro. I can't see to copy anything with au3 into a Hidden system folder like GroupPolicy. The SetAttr commands in au3 are not working on those types of folders either. I will try it on a fresh install at work tomorrow but I get a feeling it's a bug.This worked fine on both XP Pro PCs here:$var = FileCopy(@HomeDrive & "\test.ini", @SystemDir & "\GroupPolicy\User\Scripts\script.ini", 1) MsgBox(64, "Info", "FileCopy succeeded: " & ($var == 1))Notice the 3rd parameter of FileCopy(). Maybe you already had the file there. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
avery Posted April 10, 2008 Author Share Posted April 10, 2008 This worked fine on both XP Pro PCs here:$var = FileCopy(@HomeDrive & "\test.ini", @SystemDir & "\GroupPolicy\User\Scripts\script.ini", 1) MsgBox(64, "Info", "FileCopy succeeded: " & ($var == 1))Notice the 3rd parameter of FileCopy(). Maybe you already had the file there. The 3rd argument fixed me so far and thanks for the help. www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
avery Posted April 10, 2008 Author Share Posted April 10, 2008 (edited) I am now having a similar issue again at home on my WinXP 64bit box. $var = DirCreate(@SystemDir & "\GroupPolicy\Machine\Scripts") ConsoleWrite($var) $var comes back as 0 the 'Scripts' dir does not exist but 'Machine' dir does and this will not create the Scripts dir I am running this as admin, anyone know what my error is please? This worked fine on my 32bit box at work --- edit: This works, creates NIDAQ and backup dirs DirCreate(@ProgramFilesDir & "\NIDAQ\Backup") Edited April 10, 2008 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org 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