|
请大家看下下面的代码?
msgbox 显示文件夹tfolder的路径是 QTP安装路径
而在tfolder下创建的文本tfile却被保存在 系统环境变量tmp路径下
请问tfolder msgbox显示的路径和实际路径不同呢 ?
Dim fso, tempfile
Set fso = CreateObject("Scripting.FileSystemObject")
Function CreateTempFile
Dim tfolder, tname, tfile
Const TemporaryFolder = 2
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
tname = fso.GetTempName
msgbox fso.getabsolutepathname (tfolder.name)
msgbox tname
Set tfile = tfolder.CreateTextFile(tname)
Set CreateTempFile = tfile
End Function
Set tempfile = CreateTempFile
tempfile.WriteLine "Hello World"
tempfile.Close |
|