VBS教程:方法-Move 方法
Move 方法
將指定的文件或文件夾從某位置移動到另一位置。
object.Move destination
參數(shù)
object
必選項。應為 File 或 Folder 對象的名稱。
destination
必選項。目標位置。表示要將文件或文件夾移動到該位置。不允許使用通配符。
說明
對 File 或 Folder 應用 Move 方法的結果與使用 FileSystemObject.MoveFile 或 FileSystemObject.MoveFolder 執(zhí)行的操作完全相同。然而,要注意的是 FileSystemObject.MoveFile 或 FileSystemObject.MoveFolder 方法可移動多個文件或文件夾。
下面例子舉例說明如何使用 Move 方法:
Dim fso, MyFileSet fso = CreateObject("Scripting.FileSystemObject")Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)MyFile.WriteLine(
“這是一個測試?!?CODE>)MyFile.Close
Set MyFile = fso.GetFile("c:\testfile.txt")
MyFile.Move "c:\windows\desktop\"
相關文章
Shell.Application執(zhí)行命令的五種方法小結
可能很多人發(fā)現(xiàn)了在海陽頂端2006+版本中Shell.Application執(zhí)行命令的方法在win2003中不好用了。2010-11-11VBS教程:函數(shù)-LTrim、RTrim 和 Trim 函數(shù)
VBS教程:函數(shù)-LTrim、RTrim 和 Trim 函數(shù)...2006-11-11