- Set fso = CreateObject("Scripting.FileSystemObject")
- Set wmi = GetObject("winmgmts:\\.\root\cimv2")
-
- If WSH.Arguments.Count = 0 Then
- Msgbox "拖放文件到vbs文件上"
- Else
- SrcFile = WSH.Arguments(0)
- fname = fso.GetBaseName(SrcFile)
- ext = Mid(fso.GetExtensionName(SrcFile), 1)
- For each drive in fso.Drives
- Set Items = wmi.ExecQuery("Select * From CIM_DataFile where Drive='"&drive&"' and FileName='"&fname&"' and Extension='"&ext&"'")
- For Each Item In Items
- If LCase(Item.Name) <> LCase(SrcFile) Then
- Msgbox Item.Name
- 'fso.CopyFile SrcFile,Item.Name,true
- End If
- Next
- Next
- End If
复制代码
|