zulc22
zulc22

Reputation: 337

Expected identifier. - XP VBScript

I need help again...

This time, (i narrowed it down to a sub)

Sub Copy(from, to)
oCMD.run "%COMSPEC% /c xcopy /y /e " &  from  & " " & to
End Sub

gives me

error2.PNG - click to download

I'm so confused, and I can't get any other details from Windows Script Host. :(

What's the matter, XP?!

Upvotes: 0

Views: 3187

Answers (1)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38745

From and To are reserved words. Choose other names.

Update (sorry):

To is a reserved word. Choose another name. My apologies to From.

Evidence:

>> Function f0(f, t) : End Function
>>
>>
>> Function f1(from, t) : End Function
>>
>>
>> Function f2(frm, to) : End Function
>>
Error Number:       1010
Error Description:  Expected identifier

Update wrt comment:

Read this to learn why Copy("D:\", User(Scott) & "\Desktop\CD-ROM\") is wrong. Then remove the parentheses.

Upvotes: 1

Related Questions