Hey, I'm very new when working with %userprofile% ect, The code I have now is.

When I press the button VB tell me It cannot find the directory. Please note I've tried %Userprofile%, %userprofile% Nothing will work :/ What's wrong? And How do I go about fixing this.

    Private Sub testbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles testbutton.Click
        Dim s As String = Environment.GetEnvironmentVariable("UserProfile")
        Dim writeRes As New FileStream("C:\Users\UserProfile\AppData\Roaming\.ProjectName\Data\Test.exe", FileMode.Create)
        Dim binWrite As New BinaryWriter(writeRes)

I think you can access the Application directory using:


Then use the directory you wish.

If you are wanting to work with the current user just simply use:


To save alot of coding.

On Startup * Form load* I have

        My.Computer.FileSystem.CreateDirectory(Environment.ExpandEnvironmentVariables("%AppData% \.DragonLauncher"))
        My.Computer.FileSystem.CreateDirectory(Environment.ExpandEnvironmentVariables("%AppData% \.DragonLauncher\Launchers"))

how would I take a file from resources and move it to that folder ? * .DragonLauncher\launchers


Will go to my %appdata% Folder and roaming but It doesent have permission to place the exe in there how do I route it to my folders

Alright NVM all that, I'm tryin


And Upon application startup I get "The system cannot find the file specified" But when I change the %userprofile% with my PC's name * profile* it will open the file no errors... What's a fix?