vickerps 0 Posted March 10, 2004 Hi guys this is a very noob question Filecopy Return value is 0 or 1 1=success 0=failure If the filecopy fails i want to know about it so how query the return value Share this post Link to post Share on other sites
vickerps 0 Posted March 10, 2004 Cheers I have lots of files to copy to different places and I don't really want to create lot of variables and then have to write a if for each one to see if it has failed. is there any clever people out there who can suggest a better way. I was thinking about calling a function but the some of the filecopy's are contained in other functions already which will make it calling a function from a function which sounds messy. Share this post Link to post Share on other sites
Jon 1,009 Posted March 10, 2004 The copy returns 1 so do: $result = 0 $result = $result + FileCopy(....) Do this for as many files as you want, and then when you want to test if they have all been successful compare $result to the number of copies. For example if you do 10 copies and $result is 10 you know that all have succeeded. If $result does not equal 10 then one or more have failed. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Share this post Link to post Share on other sites