开发者

Getting Startup Location In Windows

开发者 https://www.devze.com 2023-04-02 10:55 出处:网络
I\'ve written a small 开发者_开发技巧program to open at startup, but I want to give the user the ability to delete it from showing on startup by clicking a button.

I've written a small 开发者_开发技巧program to open at startup, but I want to give the user the ability to delete it from showing on startup by clicking a button. But it needs to be compatible on XP, Vista and Windows 7. Is there a line of code which will get the default startup folder path automatically so I can then delete it using my button?

Thank you in advance


What you are wanting is the SpecialFolder.Enumeration. and use the Environment methods

Something like this Environment.GetFolderPath(Environment.SpecialFolder.Startup)

To do your deletion you need to use System.IO.File.Delete(path)

To check to see what files are out there try making a console application and use this code.

Module Module1

Sub Main()
    Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup)

    For Each file In System.IO.Directory.GetFiles(path)
        Console.WriteLine(file)
    Next
    Console.ReadLine()
End Sub

End Module

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号