i'm using VB.NET language on windows 10 with VS 2015
I'm trying to make a directory then copy a file from my app's resources folder to that directory
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim SubFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Main Folder\Sub Folder")
Directory.CreateDirectory(SubFolderPath)
'Error: access denied to "C:\Program Files\Main Folder\Sub Folder"
File.WriteAllBytes(SubFolderPath, My.Resources.exe1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
File.WriteAllBytes(SubFolderPath, My.Resources.exe2)
File.WriteAllBytes(SubFolderPath, My.Resources.exe2dat)
End Sub
i get error as commented in the above code, (i have admin rights)
Code result: created folder "C:\Program Files\Main Folder\Sub Folder" but then access denied while copying.
i'm not knowing why access is denied... can you help me please?