Sign in to follow this  
Followers 0
mohan93

Running the action in loop till successfull.

7 posts in this topic

#1 ·  Posted (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 by mohan93

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by l3ill
1 person likes this

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0