VB中如何将当前目录下的一个.INI(只有一个这种INI类型的文件),更改名字为,比如“新文件.txt”
3个回答
展开全部
Name Dir("*.ini") As "新文件.txt"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
FileCopy "My.INI", "新文件.TXT"
Kill My.INI
End Sub
先复制再删除。
FileCopy "My.INI", "新文件.TXT"
Kill My.INI
End Sub
先复制再删除。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Const MAX_PATH = 260
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Private Sub Command1_Click()
Dim w As WIN32_FIND_DATA
FindFirstFile Path & "***.ini", w
Name Path & w.cFileName as Path & "新文件.txt"
End Sub
其中path是你的文件目录
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Const MAX_PATH = 260
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Private Sub Command1_Click()
Dim w As WIN32_FIND_DATA
FindFirstFile Path & "***.ini", w
Name Path & w.cFileName as Path & "新文件.txt"
End Sub
其中path是你的文件目录
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询