I am trying to make a batch file which will take a comand line from text file and computer name to execute command.
But all what I succed is to take text from first file.
In first.txt I have this line
first.txt
copy /Y \\server1\Users\%computername%\john\deltmp.txt c:\logs\deltmp.txt
copy.bat
Echo %computername%>>C:\Users\Admin\test\computername.txt
for /f "delims=" %%a in (C:\Users\Admin\test\first.txt) do %%a
When I execute copy.bat I get error
The system cannot find the path specified.
0 file(s) copied.
because variable %computername% is not recognised from first.txt file
how to read computername so batch will copy that file.
I have created a file computername.txt to read from that file but don't know how to implement that in batch.
And I need it separately batch and first.txt file, because first.txt changes as needed