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
Solved

Insert credentials into a simple script

Posted on 2014-09-23
2
192 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
2 Comments
 
LVL 25

Accepted Solution

by:
Mohammed Khawaja earned 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
A short article about problems I had with the new location API and permissions in Marshmallow
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…

839 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