Sign in to follow this  
Followers 0
TWC

exit on error

4 posts in this topic

Forgive me for a stupid question but I have tried and can't make it work.

I want to run FileCopy("C:\test.txt","C:\testdir")

and if this fails I want the script to stop and exit.

THANX

Share this post


Link to post
Share on other sites



maybe

$file = FileCopy("C:\test.txt","C:\testdir") 

if $file = 0 then exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Forgive me for a stupid question but I have tried and can't make it work.

I want to run FileCopy("C:\test.txt","C:\testdir")

and if this fails I want the script to stop and exit.

THANX

if you check the manual for the function filecopy note the Return Value section

Return Value

Success: Returns 1.

Failure: Returns 0.

so this would work

if FileCopy("C:\test.txt","C:\testdir") = 0 then exit

Share this post


Link to post
Share on other sites

If Not FileCopy("C:\test.txt","C:\testdir") Then Exit

Lar.

arg same

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