1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
On error resume next
set objFSO=CreateObject("Scripting.FileSystemObject")
Set wshell = CreateObject("WScript.Shell")
source = "C:\test\"
destination = "C:\test2\"
if WScript.arguments.count=1 then
if WScript.arguments(0)="popup" then
While True
button=wshell.popup ("Copie en cours...",,"Copie",1)
select case button
case 2
oexec.Terminate()
Wshell.popup "Annulation en cours, veuillez patienter !"
wscript.quit
end select
Wend
End if
End if
If objFSO.FileExists(source & "test.txt") then 'si le fichier existe sur la source
If not objFSO.FileExists(destination & "test.txt") Then 'si le fichier n'existe pas sur la destination
set oexec=wshell.exec("wscript " & wscript.scriptfullname & " popup")
objFSO.copyFile source & "test.txt", destination 'copier le fichier sur la destination
oexec.Terminate()
Else
wscript.echo "Fichier 1 déjà copié !"
End if
End If
If objFSO.FileExists(source & "test2.txt") then 'si le fichier existe sur la source
If not objFSO.FileExists(destination & "test2.txt") Then 'si le fichier n'existe pas sur la destination
set oexec=wshell.exec("wscript " & wscript.scriptfullname & " popup")
objFSO.copyFile source & "test2.txt", destination 'copier le fichier sur la destination
oexec.Terminate()
Else
wscript.echo "Fichier 2 déjà copié !"
End if
End If |
Partager