我想用vb编一个文件的搜索程序,实现目的是,自动搜索所有盘中扩张名为.~ex的文件,并将其改成.exe文件,并且将其系统隐藏属性删掉,哪位高手可以指点一下。

解决方案 »

  1.   

    看看:
    http://search.csdn.net/Expert/topic/101/101801.xml?temp=.1392481
    至于把属性改变的话,改成隐藏的贴子就找到,改成不隐藏的就找不到了。:S
      

  2.   

    需要的话,email: [email protected]
      

  3.   

    大概这个样子:'引用部件 Microsoft Script Control 1.0
    Dim fsPrivate Sub Command1_Click()
        Dim d, dc, n
        On Error GoTo EH
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set dc = fs.Drives
        For Each d In dc
            If d.DriveType = 3 Then
                n = d.ShareName
            Else
                n = d.VolumeName
            End If
            ScanPath
        Next
        Exit Sub
    EH:
        n = ""
        Resume Next
    End SubPrivate Sub ScanPath(Byval PathName As String)
        Dim f, f1, fc, sf, s1
        Set f = fs.GetFolder(PathName)
        Set fc = f.Files
        For Each f1 In fc
            If fs.GetExtensionName(f1.Name) = .~ex Then
                f1.Name = fs.GetBaseName(f1.Name) & ".exe"
                If f.attributes and 2 Then f.attributes = f.attributes - 2
            End If
        Next    Set sf = f.SubFolders
        For Each s1 In sf
            ScanPath s1.Path
        Next 
    End Sub