Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Copy Folders Locally From Network
I want to run this from a command line
cscript.exe //nologo copy.vbs "source" "destination"
I need the code for copy.vbs that can take the source that I type in and copy it to the destination that I type in. I need the copy.vbs script to use my input on the command line as the variable for a copy folder vbscript.
Does anyone know how to do this?
Visual Basic Classic
8/22/2022 - Mon
Ben Personick (Previously QCubed)
Not sure how to do that in VBs, but it's Very simple in batch:
::Begin Batch Script
::Script Name: DoCopy.bat
XCopy "%~1" "%~2" /Z /Y
:: End batch script
You would write at the command line:
DoCopy.bat "Source" "destination"
However it really does beg the question, why don't you simply type this at the command prompt:
XCopy "Source" "Destination" /z /Y
Or better yet if the system is vista/2kgor 7. Use robocopy instead of xcopy.
Thank you for your post but it has to be VB. I am using it in MDT 2010 in a task sequence and have not been able to get anything but vbscript to work.
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I will try it and let you know.
Alternatively, there is no need for more answers as I wrote a Powershell one and tested it successfully while waiting on an answer.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
That VB script worked thank you so much!
If anyone wants a powershell one copy this easy code into a text and save it as Copy.ps1.
usage = powershell.exe -file copy.ps1 "source" "destination"
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent