ShareX

Command Line Arguments

ShareX CLI

"File or URL path"

If you specify a file path, the file will be uploaded. Providing a URL causes ShareX to download the content and then upload it. Multiple paths can be used to upload several files simultaneously.

-multi or -m

This option enables the execution of multiple ShareX instances. By default, the application is restricted to a single running instance.

-portable or -p

Invokes ShareX in portable mode. When operating in this mode, the program will create a subfolder named "ShareX" within its starting directory (if it doesn't already exist) to store all configuration files and images.

-silent or -s

Launches ShareX directly to the system tray without displaying its main window. This functionality is only available if the "Show tray icon" setting is enabled.

-sandbox

ShareX will launch with its default configuration and will not save any settings files (such as ApplicationConfig.json, HotkeysConfig.json, UploadersConfig.json, or History.xml) to disk.

Using Hotkey Actions

Any hotkey action can be utilized as a command-line argument.

Examples: -RectangleRegion, -PrintScreen, -ClipboardUpload, and -ScreenColorPicker.

A complete list of hotkey actions is available inpublic enum HotkeyType here.

These specific actions also support additional parameters:

-workflow "Hotkey description"

Your workflows (hotkey tasks) can be executed by their descriptions.

Example: -workflow "Capture rectangle region & annotate"

This will run your custom hotkey that matches the provided description.

-task "Hotkey description"

This command must accompany a file or URL path. The task settings will be applied during the upload. Only the initial matching task command is processed; subsequent ones are disregarded. The placement of the task command does not matter.

Example: "C:\\ShareX.png" -task "Upload to Imgur"

-autoclose

Once all tasks are finished, ShareX will shut down automatically.

For instance, you could use it to upload two images simultaneously, then have ShareX close after both uploads are done.

-nohotkeys

Prevents the hotkey registration error window from appearing if registration fails on startup.

-customuploader ".sxcu file path"

The specified .sxcu file path is used for adding a custom uploader configuration to ShareX..sxcuIt also serves for file association.

-imageeffect ".sxie file path"

This .sxie file path is used to integrate an image effect configuration into ShareX..sxieIt is additionally utilized for file association.

ShareX Setup CLI

/SILENT

When in silent mode, the wizard and background window are not visible, but the installation progress window is displayed.

/VERYSILENT

In very silent mode, the installation progress window is also hidden from view.

/NORUN

ShareX will not launch automatically once setup has concluded.

/UPDATE

This command stops the setup from re-applying initial tasks, such as creating a desktop shortcut or context menu entries. It is used when updating ShareX.

Registry

These registry settings must be located in either theHKEY_LOCAL_MACHINE\SOFTWARE\ShareX key or the HKEY_CURRENT_USER\SOFTWARE\ShareX key. HKEY_LOCAL_MACHINEtakes precedence overHKEY_CURRENT_USERwhen settings are being read.

DisableUpdateCheck REG_DWORD

Turns off checks for updates.

DisableUpload REG_DWORD

Disables uploads across the entire application.

DisableLogging REG_DWORD

Prevents the saving of debug log files.

PersonalPath REG_SZ

Changes ShareX's default personal path, which is by default the%UserProfile%\Documents\ShareX folder.

Windows Context Menu

You can add custom actions to the Windows context menu by utilizing ShareX command-line arguments.

ShareX adds options like "Upload with ShareX" and "Edit with ShareX" to the Windows context menu via the registry. You can similarly modify the registry to incorporate other ShareX actions.

To illustrate, to integrate a "Pin to screen" entry specifically for image files, you would use the following registry files:

AddPinToScreen.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\image\shell\ShareXPinToScreen]
@="Pin to screen"
"Icon"="\"C:\\Program Files\\ShareX\\ShareX.exe\",0"

[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\image\shell\ShareXPinToScreen\command]
@="\"C:\\Program Files\\ShareX\\ShareX.exe\" -PinToScreen \"%1\""

RemovePinToScreen.reg

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\image\shell\ShareXPinToScreen]

Personal Path Determination

ShareX determines the personal path using this ordered process:

  1. If -portable or -pIf a CLI flag is present, that path is used..\ShareX folder.
  2. If an empty .\PortableIf the file exists, its path is utilized..\ShareX folder.
  3. If the PersonalPathA registry value, if found, dictates the path.
  4. If %LocalAppData%\ShareX\PersonalPath.cfgIf it exists, the contents are moved to it.%UserProfile%\Documents\ShareX\PersonalPath.cfg.
  5. If .\PersonalPath.cfgIf it exists, the file path specified within it is used.
  6. If %UserProfile%\Documents\ShareX\PersonalPath.cfgIf it exists, the file path specified within it is used.
  7. The default personal path is then applied.%UserProfile%\Documents\ShareX.

For instance, the portable version of ShareX relies on step 2 in this sequence.