Access the Desktop and the Start Menu

Problem

You want to access shortcuts or other files on the desktop or the Start menu.

Solution

You can access the underlying Start menu and desktop directories directly by retrieving the corresponding environment variables.

Discussion

.NET does not provide any classes for interacting with the desktop or Start menu. However, you can find the corresponding directories using Windows environment variables.

For example, you can retrieve the current user’s profile directory from the environment variable USERPROFILE. This directory contains two important subdirectories: \Desktop (which holds the files that are displayed on the current user’s desktop) and \Start Menu (which holds the user-specific shortcuts on the Start ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.