获取当前临时目录路径的VB技巧:
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
在VBScript中失败.所以?
WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2)
我花了一段时间才在Google上找到它.所以对于下一个寻找和我一样的人......
Const WindowsFolder = 0 Const SystemFolder = 1 Const TemporaryFolder = 2 Dim fso: Set fso = CreateObject("Scripting.FileSystemObject") Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)
另一种可能性
CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")