Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting count of find command

Status
Not open for further replies.

cybercop23

IS-IT--Management
Aug 12, 2001
103
US
Hi all.
I'm trying asign the result of a find command to a variable that I can check. If the result is what I expect I can continue processing, else wait some more. This is what I mean:

:checkdone
set checkdone=dir done*.txt | find /c "done"
if checkdone == 5 goto done
sleep 60
goto checkdone

The set command above is not working. The results of the dir and find commans wihtout the set, returns a number. How can I assign the result of these two command to a varaible?

Thanks in advance for any suggestions.
 
Just a thought - would creating an environmental variable for checkdone = 0 work
 
The only way I can think of to get a count would be to use a loop with the "for" command. This can be done easier with vbscript. I would recommend posting in the vbscript forum.
 
The reason it is not working is in Shell Scripting, variables can only contain strings (eg. "This is a text string"). So your command output is not assigned to the variable.
Like djtech2k stated:
Vbscript and/or PowerShell.
 
Thanks All. I echoed the output to a file and read the file back in using the "for" command and tokens and it worked.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top