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)
        binWrite.Write(My.Resources.Test)
        binWrite.Close()

I think you can access the Application directory using:

My.Computer.FileSystem.SpecialDirectories

Then use the directory you wish.

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

My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

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

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

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

 System.Diagnostics.Process.Start("C:\Users\%USERPROFILE%\AppData\Roaming\.DragonLauncher\DragonLauncherData.txt")

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.