0

Installation of Strawberry Perl 5.30.0.1 inspired this question. Users of Active Perl have reported problems with the <FileType>=<OpenCommandString> pairs created during the installation of Active Perl. For example, ftype perl at the command prompt returned perl="C:\Perl\bin\perl.exe" "%1". The named pair should have read perl="C:\Perl\bin\perl.exe" "%1" %* if you wanted the invocation of file.perl arg1 arg2 to use the trailing arguments.

Strawberry Perl's installation created an association with the extension '.pl'. assoc .pl returns .pl=Perl_program_file. But searching the output of ftype returns no <FileType>=<OpenCommandString> pairs including the word 'perl' or the extension '.pl'. 'Perl interpreter' appears with '.pl' ('Perl program file') in the list 'Settings > Apps > Default Apps > Choose default apps by file type' in the Settings app.

Now my question - what is the default Open Command String issued when I double-click on a file with an associated file extension if <FileType>=<OpenCommandString> has not been set? Is it something like <FileType>="C:\Path\" "%1" %*? Here "%1" is substituted for the file name, %* is substituted for a list of arguments, per documentation (ftype - Microsoft Docs).

What do I lose if <FileType>=<OpenCommandString> is not set?

  • The named pair should really have read perl="C:\Perl\bin\perl.exe" %*. What do you have in regedit for HKEY_CLASSES_ROOT\.pl? – harrymc Jul 13 at 18:35
  • You've set me on the right track by pointing to the registry. I focused too narrowly. ftype <FILETYPE> returns a value only if an Open Command String is defined. "Open" is only one Verb that Strawberry Perl could set as the Default for ".pl". It appears that they have introduced a non-canonical verb, "Execute Perl Program", as the Default (Computer\HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program\command = C:\Perl\Strawberry\perl\bin\perl.exe "%1" %*). – SoFarther Jul 15 at 19:56
  • If you still need help, please add a screenshot with the contents of that registry key. – harrymc Jul 15 at 20:11
  • Your first comment was perfect. It led to an improved understanding of how Windows handles file association. I'll compose an answer. As for the value of the named pair set by Strawberry Perl and recommended elsewhere, C:\Perl\Strawberry\perl\bin\perl.exe "%1" %*, "%1" appends the filename for which, here, Execute Perl Program was called. I guess it would require a new question to explore effects of dropping "%1". I'll keep it in mind and do so if the current configuration leads to problems. – SoFarther Jul 15 at 20:33
0

What do I lose if "FileType=OpenCommandString" is not set?

Apparently, I lose

Strawberry Perl takes a non-standard approach in setting up its file associations. Instead of the proper Programmatic Identifier (ProgID) format, [Vendor or Application].[Component].[Version], it sets ProgID to "Perl_program_file". As described in Windows File Types documentation, they then implement a new, descriptive verb, Execute Perl Program, rather than use Open.

While non-standard, the approach is sufficient. Per Extending Shortcut Menus - Windows Docs (Windows 2000 and later),

The default verb is displayed first on the shortcut menu. Its purpose is to provide the Shell with a verb it can use when ShellExecuteEx is called but no verb is specified. The Shell does not necessarily select the default verb when ShellExecuteEx is used in this fashion. ...the Shell uses the first available verb from the following list. If none are available, the operation fails.

  • The open verb
  • The default verb
  • The first verb in the registry
  • The openwith verb

Additional references:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.