I'm teaching myself VBscript and for my first script I just want to copy one folder from another. I get a "wrong number of arguments or invalid property assignment" for line 4 char 1. I don't understand what I did wrong, can someone help me? Here's the code:
strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
& "SELECT * FROM Win_32 Directory WHERE Name = 'C:\\tomcat'"
For Each objFolder in colFolders
errResults = objFolder.Copy("C:\Program Files\")
Wscript.Echo errResults
Next
strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
& "SELECT * FROM Win_32 Directory WHERE Name = 'C:\\tomcat'"
For Each objFolder in colFolders
errResults = objFolder.Copy("C:\Program Files\")
Wscript.Echo errResults
Next