We help IT Professionals succeed at work.
Get Started

VBscripting error

833 Views
Last Modified: 2012-05-10
Can someone tell me what is wrong with this script, it errors on line 14 with an Invalid procedure call or argument on line 14.

Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject\")
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Mon.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Tue.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Wed.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Thu.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Fri.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Sat.log" , "C:\\dhcp_logs\\\", OverwriteExisting
objFSO.CopyFile "C:\\windows\\system32\\dhcp\\DhcpSrvLog-Sun.log" , "C:\\dhcp_logs\\\", OverwriteExisting

Dim wFile
With CreateObject("scripting.filesystemobject\")
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Mon.log\")
wFile.Name - "DhcpSrvLog-Mon_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Tue.log\")
wFile.Name = "DhcpSrvLog-Tue_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Wed.log\")
wFile.Name = "DhcpSrvLog-Wed_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Thu.log\")
wFile.Name = "DhcpSrvLog-Thu_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Fri.log\")
wFile.Name = "DhcpSrvLog-Fri_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Sat.log\")
wFile.Name = "DhcpSrvLog-Sat_\" & Replace(Date, "/\", "-\") & ".log\"
Set wFile = .GetFile("C:\\dhcp_logs\\DhcpSrvLog-Sun.log\")
wFile.Name = "DhcpSrvLog-Sun_\" & Replace(Date, "/\", "-\") & ".log\"
End With
Comment
Watch Question
Software Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE