Does anybody have any VB code that finds the windows temp folder?
Thanks in advance
Printable View
Does anybody have any VB code that finds the windows temp folder?
Thanks in advance
try this and see how you go ....
VB Code:
Private Declare Function GetTempPath Lib "kernel32.dll" Alias "GetTempPathA" (ByVal nBufferLength As Integer, ByVal lpBuffer As System.Text.StringBuilder) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim s As New System.Text.StringBuilder(256) GetTempPath(s.Capacity, s) MessageBox.Show(s.ToString) End Sub
Thankyou sir!
If you don't want to use an API then you can do this:
VB Code:
Environment.GetEnvironmentVariable("TEMP") 'you can get a bunch of other ones using GetFolderPath but temp isn't one of those Environment.GetFolderPath(Environment.SpecialFolder.System)
Even better.
Cheers!