Batch file to copy files from one folder to another folder

前端 未结 9 1643
臣服心动
臣服心动 2020-11-29 15:07

I have a storage folder on a network in which all users will store their active data on a server. Now that server is going to be replaced by a new one due to place problem s

9条回答
  •  天涯浪人
    2020-11-29 15:51

    if you want to copy file not using absolute path, relative path in other words:

    don't forget to write backslash in the path AND NOT slash

    example :

        copy children-folder\file.something .\other-children-folder
    

    PS: absolute path can be retrieved using these wildcards called "batch parameters"

        @echo off
        echo %%~dp0 is "%~dp0"
        echo %%0 is "%0"
        echo %%~dpnx0 is "%~dpnx0"
        echo %%~f1 is "%~f1"
        echo %%~dp0%%~1 is "%~dp0%~1"
    

    check documentation here about copy : https://technet.microsoft.com/en-us/library/bb490886.aspx

    and also here for batch parameters documentation: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

提交回复
热议问题