SOLFIND
Web Lens
Portal home

shell | Electron

https://www.electronjs.org/docs/latest/api/shell • 42 KB fetched
Open original page


shell | Electron Skip to main content Electron Docs API Blog Tools * Electron Forge * Electron Fiddle Community * Governance * Showcase * Resources Releases English * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Search * Main Process Modules * app * autoUpdater * BaseWindow * BrowserView * Deprecated * BrowserWindow * clipboard * contentTracing * crashReporter * desktopCapturer * dialog * globalShortcut * ImageView * inAppPurchase * ipcMain * Menu * MenuItem * MessageChannelMain * MessagePortMain * nativeImage * nativeTheme * net * netLog * Notification * powerMonitor * powerSaveBlocker * process * protocol * pushNotifications * safeStorage * screen * session * sharedTexture * ShareMenu * shell * systemPreferences * TouchBar * Tray * utilityProcess * webContents * WebContentsView * webFrameMain * View * Renderer Process Modules * Utility Process Modules * Custom DOM Elements * Chromium and Node.js * Classes * API Structures * * Main Process Modules * shell On this page shell Manage files and URLs using their default applications. Process: Main , Renderer (non-sandboxed only) The shell module provides functions related to desktop integration. An example of opening a URL in the user's default browser: const { shell } = require ( 'electron' ) shell . openExternal ( 'https://github.com' ) warning While the shell module can be used in the renderer process, it will not function in a sandboxed renderer. Methods ​ The shell module has the following methods: shell.showItemInFolder(fullPath) ​ * fullPath string Show the given file in a file manager. If possible, select the file. shell.openPath(path) ​ History Version(s) Changes None API ADDED * path string Returns Promise<string> - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise "". Open the given file in the desktop's default manner. shell.openExternal(url[, options]) ​ History Version(s) Changes None Added activate option. None Added workingDirectory option. >=24.0.0 Added logUsage option. * url string - Max 2081 characters on Windows. * options Object (optional) * activate boolean (optional) macOS - true to bring the opened application to the foreground. The default is true . * workingDirectory string (optional) Windows - The working directory. * logUsage boolean (optional) Windows - Indicates a user initiated launch that enables tracking of frequently used programs and other behaviors. The default is false . Returns Promise<void> Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent). shell.trashItem(path) ​ History Version(s) Changes >=12.0.0 API ADDED * path string - path to the item to be moved to the trash. Returns Promise<void> - Resolves when the operation has been completed. Rejects if there was an error while deleting the requested item. This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux). The path must use the default path separator for the platform (backslash on Windows). Use path.resolve() from the node:path module to ensure correct handling on all filesystems. shell.beep() ​ Play the beep sound. shell.writeShortcutLink(shortcutPath[, operation], options) Windows ​ * shortcutPath string * operation string (optional) - Default is create , can be one of following: * create - Creates a new shortcut, overwriting if necessary. * update - Updates specified properties only on an existing shortcut. * replace - Overwrites an existing shortcut, fails if the shortcut doesn't exist. * options ShortcutDetails Returns boolean - Whether the shortcut was created successfully. Creates or updates a shortcut link at shortcutPath . shell.readShortcutLink(shortcutPath) Windows ​ * shortcutPath string Returns ShortcutDetails Resolves the shortcut link at shortcutPath . An exception will be thrown when any error happens. Edit this page Previous ShareMenu Next systemPreferences * Methods * showItemInFolder * openPath * openExternal * trashItem * beep * writeShortcutLink * readShortcutLink Docs * Getting Started * API Reference Checklists * Performance * Security Tools * Electron Forge * Electron Fiddle Community * Governance * Resources * Discord * Bluesky * X * Mastodon * Stack Overflow More * GitHub * Open Collective * Infrastructure Dashboard Copyright OpenJS Foundation and Electron contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation , please see our Trademark Policy and Trademark List . Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. Skip to main content [direct]
  2. Electron [direct]
  3. Docs [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. Governance [direct]
  9. Showcase [direct]
  10. Resources [direct]
  11. Releases [direct]
  12. Deutsch [direct]
  13. Español [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. autoUpdater [direct]
  20. BaseWindow [direct]
  21. BrowserView Deprecated [direct]
  22. BrowserWindow [direct]
  23. clipboard [direct]
  24. contentTracing [direct]
  25. crashReporter [direct]
  26. desktopCapturer [direct]
  27. dialog [direct]
  28. globalShortcut [direct]
  29. ImageView [direct]
  30. inAppPurchase [direct]
  31. ipcMain [direct]
  32. Menu [direct]
  33. MenuItem [direct]
  34. MessageChannelMain [direct]
  35. MessagePortMain [direct]
  36. nativeImage [direct]
  37. nativeTheme [direct]
  38. net [direct]
  39. netLog [direct]
  40. Notification [direct]
  41. powerMonitor [direct]
  42. powerSaveBlocker [direct]
  43. process [direct]
  44. protocol [direct]
  45. pushNotifications [direct]
  46. safeStorage [direct]
  47. screen [direct]
  48. session [direct]
  49. sharedTexture [direct]
  50. ShareMenu [direct]
  51. systemPreferences [direct]
  52. TouchBar [direct]
  53. Tray [direct]
  54. utilityProcess [direct]
  55. webContents [direct]
  56. WebContentsView [direct]
  57. webFrameMain [direct]
  58. View [direct]
  59. Custom DOM Elements [direct]
  60. Chromium and Node.js [direct]
  61. Classes [direct]
  62. API Structures [direct]
  63. Main [direct]
  64. API ADDED [direct]
  65. >=24.0.0 [direct]
  66. >=12.0.0 [direct]
  67. ShortcutDetails [direct]
  68. Edit this page [direct]
  69. Performance [direct]
  70. Security [direct]
  71. Discord [direct]
  72. Bluesky [direct]
  73. X [direct]
  74. Mastodon [direct]
  75. Stack Overflow [direct]
  76. GitHub [direct]
  77. Open Collective [direct]
  78. Infrastructure Dashboard [direct]
  79. OpenJS Foundation [direct]
  80. Trademark Policy [direct]