WebExeBuilder Documentation

getUserDesktopDir

Category: Directory Operations

Namespace: web.directory.getUserDesktopDir

Description

Retrieves the path to the current user's Desktop directory.

Syntax

const desktopPath = await web.directory.getUserDesktopDir();

Parameters

None

Returns

Promise<string> - Returns a promise that resolves with the full path to the user's Desktop directory

Examples

Simple example

const desktopPath = await web.directory.getUserDesktopDir();
console.log('Desktop directory:', desktopPath);
// Output: C:\Users\YourName\Desktop

Save file to desktop

const desktopPath = await web.directory.getUserDesktopDir();
const filePath = desktopPath + '\\myfile.txt';

await web.files.writeTextFile({
    filePath: filePath,
    content: 'Hello from Desktop!'
});

Use Cases

  • Get the user's Desktop directory path for saving files
  • Create shortcuts or files on the user's Desktop
  • Access Desktop-specific resources

Notes

  • Returns the full absolute path to the Desktop directory
  • Path format is Windows-style with backslashes (e.g., C:\Users\YourName\Desktop)
  • No parameters required - automatically detects current user