Ive wrote a small program to open at startup, but i want to give the user a chance to delete it from showing on startup by clicking a button. But it needs to be compatible on XP, Vista and Windows 7. Is there a line of code which will get the default startup folder path automatically so i can then delete it using my button?

Thankyou in advance,


What path are you trying to get? The application's startup path?

Dim myStartupFolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)

cheers guys. I found it elsewhere. here is the code i used if anyone needs it

Dim startupfolder As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup)
        Dim path As String = startupfolder & "\" & "testing.txt"

            If System.IO.File.Exists(path) = True Then

                MsgBox("File Deleted")
                MsgBox("File Not Deleted")
            End If
        Catch ex As Exception
        End Try
commented: thanks for provided solution:) +12