mohan93 Posted January 6, 2014 Share Posted January 6, 2014 (edited) Hey Guys, Need your help In my script i want command to run the loop till my action is getting completed. I have 2 scenarios below 1. I give permission to %temp% folder using Icacls with the belwo command line. $objShell.Run("Icacls " & $TMP & " /Q /Deny Everyone:(OI)(CI)(DE,DC)") my total script has more than 100 lines, sometimes before executing the above line successfully only my script is going to next line. I want to check whether the above action is completed successfully and then move to next step. how to check for the same and run the commmand in loop till the action completed sucessfully. 2. the same with file copy also, i want to do the action in Loop till the file copy is successful. (trying to copy a file starting with GLS in %temp% folder to my output folder. FileCopy($TMP & "GLS*.*", $OutFolder) Please assist. Cheers. Edited January 6, 2014 by mohan93 Link to comment Share on other sites More sharing options...
l3ill Posted January 6, 2014 Share Posted January 6, 2014 (edited) Runwait ??Edit:2. run a verifier in a If Else Nested Loop.Bill Edited January 6, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
mohan93 Posted January 6, 2014 Author Share Posted January 6, 2014 This command applies permission to %temp% folder. $objShell.Run("Icacls " & $TMP & " /Q /Deny Everyone:(OI)(CI)(DE,DC)") Till the above command is sucessfull, we need to run the commandin loop. and same for file copying also FileCopy($TMP & "GLS*.*", $OutFolder) Link to comment Share on other sites More sharing options...
l3ill Posted January 6, 2014 Share Posted January 6, 2014 (edited) Or you could try the verifier with a Do Until (file is present)loop. edit: spelling Something like this: Do FileCopy($TMP & "\*.gls", $OutFolder) Until FileExists($OutFolder & "\*.gls") = 1 Edited January 6, 2014 by l3ill mohan93 1 My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted January 6, 2014 Share Posted January 6, 2014 This looks wrong to me: FileCopy($TMP & "\GLS*.*", $OutFolder) try this (unless of course it is working for you) FileCopy($TMP & "\*.gls", $OutFolder) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
mohan93 Posted January 7, 2014 Author Share Posted January 7, 2014 Thanks l3ill for file copy i will go with Do untill command as you suggested. But for the below command, how to check whether the command executed sucessfully. $objShell.Run("Icacls " & $TMP & " /Q /Deny Everyone:(OI)(CI)(DE,DC)") This command gives deny permission to folder. Link to comment Share on other sites More sharing options...
l3ill Posted January 7, 2014 Share Posted January 7, 2014 (edited) Have a look at FileGetAttrib edit: BTW while your at it you can use the FileSetAttr as well for the above mentioned command... Edited January 7, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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