Solved

vbscript file copy

Posted on 2008-06-20
2
771 Views
Last Modified: 2010-04-21
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).  
0
Comment
Question by:fmcsa004
2 Comments
 
LVL 3

Accepted Solution

by:
tim_mcgue earned 125 total points
ID: 21834892
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

0
 

Author Closing Comment

by:fmcsa004
ID: 31469324
Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now