The VB trick to get the path of the current temporary directory:
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
fails in VBScript. So?
The VB trick to get the path of the current temporary directory:
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
fails in VBScript. So?
WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2)
It took me a while to find it on Google. So for the next one looking for the same as me...
Const WindowsFolder = 0
Const SystemFolder = 1
Const TemporaryFolder = 2
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)
Another possibility:
CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")