I'm using a .bat file to get some files from a shared folder on another computer in the same network. My challenge is that the shared folder is password protected. Is there a way to write username and password in a batch file when getting files from a shared folder located on another computer?

@echo off
Move /Y \\path\to\files\*.csv \\path\to\local\folder\
@echo off
net use X: \\path\to\files\ /user:<username> <password>
move /y x:\*.csv \\path\to\local\folder\
net use x: /d
  • Thanks a lot. It works perfect. the only thing i need to modify is to remove the last \ from \\path\to\files\, otherwise I got "system error 67 has occurred". – Zhenyu Sep 8 '14 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.