I'm trying to copy files from remote machine using construction like this
copy smb://DOMAIN;USERLOGIN:Password@100.10.10.10/folder/ C:/tmp/
it shows next message –
The filename, directory name, or volume label syntax is incorrect.
I guess that win command "copy" works only with directories…
The main idea is to copy files over SMB protocol EXACTLY within userLogin and password.
So, I was serfing the internet and i found that "USE NET" may help me.
When i tried to use it, it said me that there are multiple connections on the same resource.
Then i tried to "USE NET \COMPNAME\folder DELETE" it shew that operation had been performed sucessful but message about multiple connections still the same during another attempts of using "USE NET".
Furthermore – if i could make such NET resource, would i be able to copy\delete files from that?
Thanks in advance.
P.S. Sorry for my poor English.
———Updated———————–
As Somesh mentioned i 've used USE NET for downloading files from multiple places
But unfortunately problem with multiple connetions within login and pass still exist. I couldnt find any active on current machine by using USE NET without an arguments.
Similar problem is here: System error 1219 has occurred
if it interesting to someone here is my sample-script:
@echo off
@echo initializing loop.
set disk="T"
set destination="D:\downloads\temp"
REM set user = "USER"
REM set password = "PASS"
REM set domain = "DOMAIN"
for /F %%S in (shares.txt) do (
@echo start of performing: %%S
@echo next step: mount network disk %disk%:
pause
DIR %disk%: 1>NUL && net use %disk%: /delete
net use %disk%: %%S /persistent:no
REM net use %%S /USER:%domain%\%user% %password% /persistent:no
@echo next step: copy all files from %disk%: to %destination%
pause
xcopy %disk%:\* %destination% /s /i /c
@echo next step: dismount network disk %disk%:
pause
net use %disk%: /delete
)
pause
Best Answer
In a script, mount the SMB/CIFS share with the net command.
You can use xcopy to copy the files to or from the SMB/CIFS share. After finishing copy, you could optionally remove the share from the Windows workstation.
You can get full options of the net command by running
net help use
.