• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 822
  • Last Modified:

vbscript file copy

You guys have been a great help in my creation of a vbscript that stops several services and then uninstalls several applications.  I now also need to add a line to the end of script that copies a file from a network share to a path on the local c:\ drive of the machine (i.e. source=\\servername\sharename\file to copy destination=c:\foldername).  
1 Solution
see snippet
Const OverwriteExisting = True
strFileOrigination = "\\Servername\ShareName\FileName.ext"
strFileDestination = "c:\DirectoryName\"
'Shell object
Set WshShell = WScript.CreateObject("WScript.Shell")
'file system object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'copy the file
objFSO.CopyFile strFileOrigination, strFileDestination, OverwriteExisting

Open in new window

fmcsa004Author Commented:
Thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now