So I'm trying to copy a local file to my network using batch scripting and would like to be able to get a result to know if the process completed properly.
My code is below:
@echo off
set locatie_folder=G:\Info\instructiuni.mht
for /f "tokens=1,2 delims= " %%a in (IP.txt) do (
copy %locatie_folder% "\\%%a\vsr">> temp.tmp
set /p VAR=<temp.tmp
echo %%b %VAR%
del temp.tmp
)
pause
exit
My IP.txt file looks like so:
10.117.14.10 100-01
10.117.14.11 100-02
10.117.14.12 100-03
First is the IP and second is a dedicated name for that IP in the network.
I need to output something like
100-01 1 file(s) copied.
100-02 0 file(s) copied.
100-03 1 file(s) copied.
Now my problem is that for some reason the variable VAR is not getting me the status "0 file(s) copied." or "1 file(s) copied." while reading even if it writes properly in the temp.tmp file.
What am I doing wrong here?