Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert credentials into a simple script

Posted on 2014-09-23
2
Medium Priority
?
197 Views
Last Modified: 2014-09-24
How do i add credentials to the target folder portion of this script? Basically we are using it to temporarily copy files from one server to another but they are on separate domains. I want to stick with this script and format if possible for consistency.


set TargetFolder=G:\Share\*.pdf
set DestinationFolder=\\192.168.1.6\SHARE\SUBDIR

Move "%TargetFolder%" "%DestinationFolder%"
0
Comment
Question by:Solutionpartner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Mohammed Khawaja earned 2000 total points
ID: 40340640
this is what you could do:

set targetaccount=domainname\username
set targetpassword=password
set TargetFolder=G:\Share\*.pdf
set DestinationFolder=\\192.168.1.6\SHARE\SUBDIR

net use %DestinationFolder% /user:%targetaccount% %targetpassword%
Move "%TargetFolder%" "%DestinationFolder%"
net use %DestinationFolder% /delete
0
 

Author Closing Comment

by:Solutionpartner
ID: 40341879
Mohammed - Worked perfect. Thanks for putting that together for us.

Doug
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

721 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