from batch to powershell - script to cp file from remote computer to server RRS feed

  • Question

  • Hi,

    Ive got a problem converting old batch script to powershell.

    What i want to do is to copy from PC1,2,3,4.... to SERVER1 a file from every computer from currently logged userprofile. 

    ex. \\PC1\c$\$env:USERPROFILE\appdata\file\file.1 copy to \\SERVER1\username\file\file.1

    This is the old batch, it was designed to startup with system 

    @echo off

    SET backpath=\\server\backup
    SET backfolder=%backpath%\%username%_%computername%

    MD %backfolder%

    @echo on
    copy /y "%appdata%\file\file.1l" "%backfolder%\file.1"

    @echo off

    • Moved by Bill_Stewart Monday, July 30, 2018 1:38 PM This is not "translate my code into a different language for me" forum
    Thursday, June 7, 2018 10:35 AM