Files.LaunchFile
----------------

Launches the file or opens folder.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Files](component_Files.md) | [2.7](newinversion27.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Files.LaunchFile"; Path { ; NewInstance } ) 

**MBS**( **"Files.LaunchFile";** /\* Launches the file or opens folder. \*/  
**$Path**; /\* Native path to the item to launch.e.g. "/Users/cs/Desktop/Notes.rtf" \*/   
**$NewInstance**) /\* Optional; Whether to launch new app instance on Mac.  
Default is 0.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Path | Native path to the item to launch. | "/Users/cs/Desktop/Notes.rtf" |  |
| NewInstance | Whether to launch new app instance on Mac.   Default is 0. | 1 | Optional      Added in version **7.2**. |

### Result

Returns "OK" or error.

### Description

Launches the file or opens folder.  
The OS will lookup what application is associated with the file type and launch the application asking it to open the document.  
  
See also [Files.Launch](FilesLaunch.md) if you need to pass application and document.  
If you launch a folder path, the folder will open in Finder/Explorer.  
  
Please use Files.LaunchFile to open a file and [Files.Launch](FilesLaunch.md) to open a file in a specific application.  
Check also the [Shell](component_Shell.md) functions to run command line tools and get the output. This may work on the server, where the normal launch function may not work due to missing GUI.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
### Examples

Shows a folder in Finder on Mac:

 MBS ( "Files.LaunchFile"; "/Users" )  
Write container to temp file and launch:

 # get temp folder   
Set Variable \[$TempFolder ; Value:MBS ( "[Folders.SystemTemporary](FoldersSystemTemporary.md)" )\]  
\# and file name from container   
Set Variable \[$name ; Value:MBS ( "[Path.LastPathComponent](PathLastPathComponent.md)"; test::myContainer )\]  
\# add name to folder path   
Set Variable \[$TempPath ; Value:MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; $TempFolder ; $name )\]  
\# now write temp file   
Set Variable \[$r ; Value:MBS ( "[Files.WriteFile](FilesWriteFile.md)"; test::myContainer ; $TempPath )\]  
\# and launch file   
Set Variable \[$r ; Value:MBS ( "Files.LaunchFile"; $TempPath )\]  
Launch new copy of same app:

 MBS ("Files.LaunchFile"; "/Applications/FileMaker Pro 15 Advanced/FileMaker Pro Advanced.app"; 1)  
Launch word file on Windows:

 Set Variable \[ $r ; Value: MBS ( "Files.LaunchFile"; "C:\\Users\\Christian\\Desktop\\test.docx" ) \]  
Launch Script taking a list of files to launch:

 Set Variable \[ $list ; Value: Get(ScriptParameter) \]   
\#   
\# loop over file paths received   
Set Variable \[ $count ; Value: ValueCount($list ) \]   
Set Variable \[ $index ; Value: 1 \]   
If \[ $index ≤ $count \]   
 Loop  
 # launch it  
 Set Variable \[ $path ; Value: GetValue($list ; $index ) \]   
 Set Variable \[ $r ; Value: MBS ( "Files.LaunchFile"; $path ) \]   
 # wait half a second  
 Pause/Resume Script \[ Duration (seconds): ,5 \]   
 #   
 # next  
 Set Variable \[ $index ; Value: $index + 1 \]   
 Exit Loop If \[ $index &gt; $count \]   
 End Loop  
End If  
Open documents folder:

 Set Variable \[ $r ; Value: MBS ("Files.LaunchFile"; MBS ("[Folders.UserDocuments](FoldersUserDocuments.md)")) \]  
Launch notes app:

 MBS ( "Files.LaunchFile"; "/System/Applications/Notes.app")  
### See also

- [Files.Launch](FilesLaunch.md)
- [Files.RevealFile](FilesRevealFile.md)
- [Files.WriteFile](FilesWriteFile.md)
- [Folders.System](FoldersSystem.md)
- [Folders.SystemTemporary](FoldersSystemTemporary.md)
- [Folders.UserDocuments](FoldersUserDocuments.md)
- [Path.LastPathComponent](PathLastPathComponent.md)
- [PDFKit.Combine](PDFKitCombine.md)
- [PDFKit.Open](PDFKitOpen.md)
- [Shell.Execute](ShellExecute.md)

### Release notes

- **Version 15.3**
    - Rewrote macOS part of [Files.LaunchFile](https://www.mbsplugins.eu/FilesLaunchFile.shtml) to use newer API on macOS 10.15 or higher.
- **Version 13.3**
    - Rewrote [Files.LaunchFile](https://www.mbsplugins.eu/FilesLaunchFile.shtml) function for macOS to use newer API.
- **Version 7.2**
    - Added NewInstance parameter for [Files.LaunchFile](http://www.mbsplugins.eu/FilesLaunchFile.shtml) and [Files.Launch](http://www.mbsplugins.eu/FilesLaunch.shtml) function.

### Example Databases

- [DynaPDF/Shrink PDF pages](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Shrink%20PDF%20pages.shtml#2ScriptAnchor_)
- [Files/Launch](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Files/Launch.shtml#1GroupButton66.0000000420.000000091.0000000553.0000000LayoutObjectAnchor_)
- [Mac only/RichText/Write Document](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/RichText/Write%20Document.shtml#1ScriptAnchor_)
- [WordFile/WordFile](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WordFile/WordFile.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 15.3pr7](https://www.mbsplugins.de/archive/2025-07-10/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 15 - vCard QR](https://www.mbsplugins.de/archive/2024-12-15/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 7 - Open Files With Roundabout Route Via Temporary Files](https://www.mbsplugins.de/archive/2024-12-07/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 12 - Files](https://www.mbsplugins.de/archive/2023-12-12/MBS_Plugin_Advent_calendar_12_/monkeybreadsoftware_blog_filemaker)
- [Tips and tricks with MBS](https://www.mbsplugins.de/archive/2023-08-10/Tips_and_tricks_with_MBS/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 13.3](https://www.mbsplugins.de/archive/2023-07-25/New_in_MBS_FileMaker_Plugin_13/monkeybreadsoftware_blog_filemaker)
- [LogicalDOC Webservice](https://www.mbsplugins.de/archive/2017-12-27/LogicalDOC_Webservice/monkeybreadsoftware_blog_filemaker)
- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.7fc](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin 2.7 Release notes](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_27_Releas/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2025, Seite 25](https://filemaker-magazin.de/neuigkeit/4286-Appetithappen-FMM_202502)
- [Ausgabe 6/2021, Seite 21](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)

This function checks for a license.

Created 18th August 2014 , last changed 8th July 2025

  
[Files.Launch](FilesLaunch.md) - [Files.List](FilesList.md)

[HTML Version](FilesLaunchFile.shtml)