Display .exe files in textbox that are in all program files

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hey everyone. Starting working on a program to list all .exe files in program files and then allow you to create a shortcut that gets put in the start menu folder. (This is to fix the virus that moves start menu to temp location, and then you delete the temp files, leaving you without a startmenu unless you rebuild them by hand....aka copy paste a lot)
I can run this and it works fine.Imports System
Imports System.IO
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim returnValue As String()
returnValue = (Directory.GetFiles("C:windowssystem32", "*.exe", SearchOption.TopDirectoryOnly))
Dim string1 As String
For Each string1 In returnValue
TextBox1.AppendText(string1 & Environment.NewLine)
Next
End Sub
End Class

This lists all the .exe files in system32.
When i run this Imports System
Imports System.IO
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim returnValue As String()
returnValue = (Directory.GetFiles("C:Program Files", "*.exe", SearchOption.AllDirectories))
Dim string1 As String
For Each string1 In returnValue
TextBox1.AppendText(string1 & Environment.NewLine)
Next
End Sub
End Class

Gives me an error Access to the path C:Program FilesWindowsApps is denied.
Am i going to have to subinacl permissions to all files and folders in the program files directory and then change them back? Any other ideas?

View the full article
 
Back
Top