FileCopy "file1","file2"
Kill "file1"

解决方案 »

  1.   

    Name "c:\aaa.txt" As "c:\bbb.txt"   ' 更改文件名
    注意一定要带文件后缀。
    还可以更改文件存放路径
      

  2.   

    dim fs as object
    Set fs = CreateObject("Scripting.FileSystemObject")
    调用fs的一些属性。就可以修改文件名
    也可以对文件夹进行操作!
    例如
    Private Sub GetBatch()
        Dim fs, f, fc, f1 As Object
        Dim strFileName As String
        Set fs = CreateObject("Scripting.FileSystemObject")
        If fs.folderexists(g_ImagePath) = False Then
             MsgBox "指定的文件夹不存在", , "系统提示!"
            Exit Sub
        End If
        Dim i As Integer
        Set f = fs.getfolder(g_ImagePath)
        Set fc = f.Files
        For Each f1 In fc
            strFileName = f1.Name
            If LCase(fs.GetExtensionName(strFileName)) = "txt" Then
                cboBatch.AddItem fs.getbasename(strFileName)
            End If
        Next
        
        Set fc = Nothing
        Set f = Nothing
        Set f1 = Nothing
        Set fs = Nothing
    End Sub