knownFolderPath Method

Retrieves a Known Folder Universal Naming Convention (UNC) path.

Syntax

strKnownFolderPath = System.Shell.knownFolderPath(strKnownFolderID)

Parameters

strKnownFolderID Required. String that specifies the Known Folder ID.
Note  For Windows 7, this method can accept a KNOWNFOLDERID globally unique identifier (GUID).

Return Value

String that specifies the UNC path.

Remarks

strKnownFolderID represents the GUID that identifies standard folders registered with the system as Known Folders. These folders are installed with Windows Vista and later operating systems; a computer will only have the folders appropriate to it installed.

The following are valid well-known folder names:

  • Desktop
  • Startup
  • StartMenu
  • Documents
  • Programs
  • CommonStartup
  • CommonPrograms
  • PublicDesktop
  • PublicFavorites
  • PublicDocuments
  • System
  • SystemX86
  • Profile
  • Windows
  • Pictures
  • Music
  • Videos
  • ProgramFiles
  • ProgramFilesCommon
  • ProgramFilesX86
  • ProgramFilesCommonX86
  • AdminTools
  • CommonAdminTools
  • PublicMusic
  • PublicPictures
  • PublicVideos
  • UserProfiles
  • Downloads
  • PublicDownloads
  • GadgetsUser
  • RecycleBinFolder
Note   Well-known names can vary across operating systems.

Example

The following example demonstrates how to retrieve the UNC path for a known folder.

// --------------------------------------------------------------------
// Display the UNC path of the Known Folder.
// txtKnownFolderID: the Known Folder GUID.
// --------------------------------------------------------------------
function GetKnownFolderPath(txtKnownFolderID)
{
    try
    {
        spFeedback.innerHTML = System.Shell.knownFolderPath(txtKnownFolderID) + "<br/>";
    }
    catch(e)
    {
        spFeedback.innerHTML = "Unable to retrieve path.<br/>";
    }
}

Applies To

System.Shell
Tags :


Page view tracker