Script de lot - COPIER

Cette commande par lots est utilisée pour copier des fichiers d'un emplacement à l'autre.

Syntaxe

Copy [source] [destination]

Les fichiers seront copiés de la source vers l'emplacement de destination.

Exemple

L'exemple suivant montre les différentes variantes du copy commander.

@echo off
cd
Rem Copies lists.txt to the present working directory.
If there is no destination identified , it defaults to the present working directory.
copy c:\lists.txt
Rem The file lists.txt will be copied from C:\ to C:\tp location
copy C:\lists.txt c:\tp
Rem Quotation marks are required if the file name contains spaces
copy “C:\My File.txt”
Rem Copies all the files in F drive which have the txt file extension to the
current working directory copy
F:\*.txt
Rem Copies all files from dirA to dirB. Note that directories nested in dirA will not be copied
copy C:\dirA dirB

Production

Toutes les actions sont effectuées conformément aux remarques du fichier de commandes.