I wrote this batch file and I am trying to get it to run in cmd prompt but I keep getting a syntax error on the FOR loop. I just want to copy files to computers on my network.
Here is the code for the batch file.
The complist file contains
PC1
PC2
PC3
What is wrong?
set FILE2COPY = C:\test1\[login to view URL]
set COMPLIST = C:\test1\[login to view URL]
for /f %%a in ("%COMPLIST%") do (
set WIN7 = \\%%a\c$\Program Files (x86)\test1
set WINXP = \\%%a\c$\1test
if EXIST "%WIN7%" (set COPYDIR =%WIN7%
)
else ( if EXIST "%WINXP%" ( set COPYDIR =%WINXP%
)
else ( ECHO No such directory exists for computer %%a
pause
GOTO :END
)
)
copy "%FILE2COPY%" "%COPYDIR%" /Y
)
Pause
:END
I also use batch scripts in doing data back up in our company all the time. I wrote a lot of program using it. Im sure I can fix the error on your code.
So what your trying to do is copy the file "[login to view URL]" and put it into PC1, PC2, PC3 programfiles\test folder.
I can get it done. let me know if your interested.
$30 USD 3 napon belül
5,0 (3 értékelés)
1,9
1,9
2 szabadúszó adott átlagosan $30 USD összegű árajánlatot erre a munkára