Computing.Net > Forums > Windows Vista > Error: Expected 'Then'

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Error: Expected 'Then'

Reply to Message Icon

Name: madhavicnn
Date: July 19, 2009 at 07:28:57 Pacific
OS: Windows XP
Subcategory: Software Problems
Comment:

Hi ,

I am getting error while compling the vb script

Error: Expected'Then'
Code : 800A03F9

while running follwoing vb script for renaming a file.

DIM sourcepath
sourcepath="D:\NEW" 'The path to the source file, includes backslash
DIM sourcefile
sourcefile="server.log" 'The name of the source file without a loop number
DIM destpath
destpath="D:\NEW" 'The path to the destination file, includes backslash
DIM max
max=1000 'The maximum number of copies to keep
DIM a
a=0 'A loop counter
'**** Main Loop ****
FOR a = max-1 TO 1 'Create a decreasing loop counter
IF EXIST destpath &sourcefile &a THEN 'If the filename with current counter's value exists.....

COPY (sourcepath & sourcefile, destpath & sourcefile & a+1) 'Copy the file adding the loop counter + 1

END NEXT 'Break out of the FOR-NEXT loop now
END IF
NEXT a 'Otherwise, decrement the loop counter by one and try again.


If someone can help ,

Thanks in Advance



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows Vista Forum Home


Sponsored links

Ads by Google


Results for: Error: Expected 'Then'

No DVD/CD drive Icon www.computing.net/answers/windows-vista/no-dvdcd-drive-icon/2207.html

Family setup www.computing.net/answers/windows-vista/family-setup/2420.html

i want to dual boot, but am clueles www.computing.net/answers/windows-vista/i-want-to-dual-boot-but-am-clueles/2667.html