Home News Remote Host file copy

Remote Host file copy

by Roger Lund

I had a request to write a bat file that would copy a host file a Administrator had created, across the network to the device he wanted it on.

 

Below is the bat file. You would create the host file in the same directory as this bat resides, and then type in the Hostname or IP Address of the destination device.

I tested this on Windows XP.

“

@echo off
:Return
:: =================================
echo *********************************************************
echo **                                                     **
echo **          Remote copy of host file                   **
echo **       ———————————–           **
echo *********************************************************
echo **                                            **
echo *********************************************************
echo **       Type Computer Hostname                        **
echo **                                                     **
echo *********************************************************
echo .                                                       .
SET /P var=Hit Enter:

net use X: \%var%c$

copy /y hosts "X:windowssystem32driversetchosts"

cd C:
C:
net use X: /Y /delete
GOTO:Return

“

You would need domain admin rights.

You may also like