Insert credentials into a simple script

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%"
SolutionpartnerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Mohammed KhawajaConnect With a Mentor Manager - Infrastructure:  Information TechnologyCommented:
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
 
SolutionpartnerAuthor Commented:
Mohammed - Worked perfect. Thanks for putting that together for us.

Doug
0
All Courses

From novice to tech pro — start learning today.