Copy contents of file and append with remote machine name

G

Guest

Guest
Hello,

I need to copy the contents of a .txt file on multiple remote computers and append with the machine name it is copied from. I wrote this to copy the file (>>logfile.txt 2>%1 echo type \\computer12345 \c$\bgi\info.txt) which works fine, but I am unable to snag machine name as well. Any help would be greatly appreciated.
 
Hello,

I need to copy the contents of a .txt file on multiple remote computers and append with the machine name it is copied from. I wrote this to copy the file (>>logfile.txt 2>%1 echo type \\computer12345 \c$\bgi\info.txt) which works fine, but I am unable to snag machine name as well. Any help would be greatly appreciated.

In a batch file, %computername% will give you the name of the PC the batch file is run on.

To get remote PC names you will probably need to use something more advanced like vbscript.