0

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\
pause
Zhenyu
  • 263
  • 1
  • 3
  • 10

1 Answers1

1
@echo off
net use X: \\path\to\files\ /user:<username> <password>
move /y x:\*.csv \\path\to\local\folder\
net use x: /d
pause
Sergey
  • 2,121
  • 15
  • 14
  • 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 08 '14 at 12:01