Opening Files from Command Line
You can open an arbitrary file, folder, or project for editing in CLion from the command line, optionally specifying where the caret should rest after opening the file.
In the command line, run the following command:
<CLion> [--line <number>] pathFor example, on Windows:C:\Program Files\JetBrains\CLion 2019.1\bin>clion --line 5 C:\CLionProjects\Calendars\Calendar-master\main.cpp
The command options are as follows:
Option | Description |
---|---|
<CLion> | The platform-specific CLion launcher. On macOS and Linux, it is recommended to use the command-line launcher created during the CLion installation, or create one manually by selecting on the CLion main menu. Refer to Enable a command-line launcher on macOS/Linux for details. On Windows, it is recommended to add the path to the CLion executable to the |
path | The path to the file or the folder to be opened.
|
--line <number> | (optional) The line number, on which the caret should rest after opening the file. |