Hi guys, I have this code here: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Dir("%temp%\test.txt") <> "" Then Label1.ForeColor = Color.Red Label1.Text = ("Found!") Else Label1.ForeColor = Color.Green Label1.Text = ("Passed!") End If End Sub Code (markup): So if the file test.txt in the %temp% (C:\Documents and Settings\Nick\Local Settings\Temp) folder is found it will display red and change the label to found.. But for some reason it doesn't read like console or batch files do? Is there a way to recognize the directories using something similar to %user% and %temp% and %sysroot% instead of typing out the whole directory? If I could I would type out the whole directory but if I ran the program on another computer, it doesn't have the same username as me etc.... Any ideas? Thanks!
It sounds like VB6 to me.... You can use Window API functions to get these paths. See this for getting special paths using VB6.
See following articles: Get temp path and temp filename using .Net How to get special folders using .Net