Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What "command verbs" are available for the os.startfile 'operation' argument and what do they do?

Tags:

According to the Python documentation, os.startfile takes two arguments: path and operation. Path is fairly well described and self-explanatory, but for operation, all that is said is:

When another operation [(not 'open')] is given, it must be a “command verb” that specifies what should be done with the file. Common verbs documented by Microsoft are 'print' and 'edit' (to be used on files) as well as 'explore' and 'find' (to be used on directories).

This implies that other command verbs exist. Are there any other available command verbs? If so, what are they and what do they do?

Specifically, I would like to know the command verb associated with the "Open file location" operation.

like image 739
Ian Avatar asked Dec 07 '18 14:12

Ian


1 Answers

Since all startfile does is basically a call to ShellExecuteW from shell32, this is not really Python-specific.

Microsoft docs indicate that the operations (“verbs”) available in the ShellExecute family of functions depend on the exact system (registry). As per that page, “commonly available verbs” are:

  • edit — Launches an editor and opens the document for editing.
  • find — Initiates a search starting from the specified directory.
  • open — Launches an application. If this file is not an executable file, its associated application is launched.
  • print — Prints the document file.
  • properties — Displays the object's properties.
like image 158
Norrius Avatar answered Oct 23 '22 10:10

Norrius