No announcement yet.

Creating of a batch file and Copy file to Machines

  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating of a batch file and Copy file to Machines

    Hi, can someone please help us!!
    I have 2 requests:
    1. We need to copy 2 files from 1 machine to 65 other machines on our network, can someone help in creating a batch/script file which looks at a .txt file with a list of all the machine ip address and then copies 2 files to all the machines listed?
    [b]2. I all so need to create a reg add entry for pointing the IE (Internet Explorer) proxy server to a IP address for HKCU, which will be 1 of the file for the above questions.
    Here is the entry we have created so far, but when we run this from a entry in a .bat file we get a error message "invalid key name".
    reg add "\\%1\HKCU\Software\Microsoft\Windows\CurrentV ersi on\Internet Settings" /v ProxyServer /d /f

    I'm sorry if this is not making alot of sense but i've been up for over 27 hours trying to fix a number of issues and my support team is not available due to it being the weekend.

    Thks, for anyone that can help us!!

  • #2
    Re: Creating of a batch file and Copy file to Machines

    You can copy the *.txt files with a batch:
    @echo off
    (Set FileSource=c:\myfolder\*.txt)
    (Set RemoteDestinationFolder=c:\testfolder)
    (Set InputFile=c:\Computers.txt)
    (Set RemoteDestination=\\%%*\%RemoteDestinationFolder::=$%\)
    For /F "eol=;" %%* in ('type "%InputFile%"') do (
     Ping.exe -n 2 -w 750 %%* | Find/i "TTL=" >Nul&&(
     xcopy /y "%FileSource%" "%RemoteDestination%")||(
      echo.%%* "Computer was Not found">>%InputFile%.errors.log)
     If Not ErrorLevel 0 echo.%%* "Copy was unsuccesfull">>%InputFile%.errors.log
     (Set ErrorLevel=)
    Note: for "RemoteDestinationFolder" use the local path!, the batch will translate that to a networkpath.
    The batch creates an errorlog containting the names of the computers that were not on-line that moment. You can use the errorlog as the new inputfile, to re-run the batch.

    - 2 -
    Editing the remote HKEY_CURRENT_USER is not at all possible using your command. Since this "HKCU" is not a registry hive it self, it only exist for the currently logged on user, if you remotely access the computer you can not edit it, because it will not be there for you. Neighter can you access the user's NTUser.dat because it will be in use.
    It is possible though to edit the HKEY_USERS under the SID-regkey of the currently logged on user (there is an vbs example that you can find on this site But this only affect just the one user, if you want to configure all users, then create a logon script.

    and.... hy, do have a good rest first! before starting to change the registries on all the clients.


    -= EDIT =-
    link to: RemoteEditRegistry.vbs (for editing registry entries that affect the HKEY_CURRENT_USER of the current logged on user)
    Last edited by Rems; 20th January 2008, 22:29. Reason: added the link to 'RemoteEditRegistry.vbs'

    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts