Get files from a shared folder with password from a anohter computer with batch file

batch

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

Best Answer

@echo off
net use X: \\path\to\files\ /user:<username> <password>
move /y x:\*.csv \\path\to\local\folder\
net use x: /d
pause
Related Topic