This is my first .bat
file. I want to make a script to copy all my files from USB or DVD/CD when volume is detected to hardisk.
I did not find something good. I think I need to implement something like this:
while(!volume:e /*if is DVD*/ || !volume:g /*if is USB*/)
keep seeking
if(volume:e is detected)
xcopy e:\* d:\Backup\ /s /q
if(volume:g is detected)
xcopy g:\* d:\Backup /s /q
My final result:
:while
if ("wmic logicaldisk where drivetype= '2' get volumename") NEQ "No Instance(s) Available."::HERE IS THE PROBLEM
(GOTO :Syntax) else (GOTO :while)
:Syntax
xcopy e:\* d:\Backup\ /s /q
//Use DriveType=5 for DVDs
I don't know how to write after NEQ
, because if no USB is connected cmd print No Instance(s) Available.
, but don't work correct for what I want.
Please help me... what do I miss?