5) Here's a crazy one I just found out today:
The assoc command cannot have any SPACES after the assoc name. Yep, if you 
have any spaces after PerlScript in 

assoc .pl=PerlScript

your association will never work.  I had spaces because I generate the 
command in a script like this:

echo ::@echo off                                            > 
%post_exp_bat%
echo ::                                                    >> 
%post_exp_bat%
echo set owd=%%cd%%                                        >> 
%post_exp_bat%
echo ::                                                    >> 
%post_exp_bat%
echo rem This should put us one level up, in order to link >> 
%post_exp_bat%
echo rem then directory 'perl' to the strawberry dir       >> 
%post_exp_bat%
echo cd ..                                                 >> 
%post_exp_bat%
echo ::                                                    >> 
%post_exp_bat%
echo echo Remove any existing link                         >> 
%post_exp_bat%
echo if exist perl rmdir perl                              >> 
%post_exp_bat%
echo ::                                                    >> 
%post_exp_bat%
echo echo Link the new version                             >> 
%post_exp_bat%
echo mklink /d perl %%owd%%                                >> 
%post_exp_bat%
echo echo Now add Perl to PATH                             >> 
%post_exp_bat%
echo cd perl                                               >> 
%post_exp_bat%
echo call update_env.pl.bat --do                           >> 
%post_exp_bat%
echo echo Associating .pl with perl.exe                    >> 
%post_exp_bat%
echo ftype PerlScript="%%cd%%\bin\perl.exe" "%%1" %%*      >> 
%post_exp_bat%
echo assoc .pl=PerlScript                                  >> 
%post_exp_bat%
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
see all these spaces ----||||||||||||||||||||||||||||||||||

It was those spaces that were screwing be up.
--
Matthew O. Persico

Lazard
30 Rockefeller Plaza
New York, NY 10112
212 632 6136



From:   Matthew Persico/ITS/Lazard
To:     kmx <k...@atlas.cz>
Cc:     win32-vanilla@perl.org
Date:   04/17/2014 10:29 AM
Subject:        Re: Run an external program and capture its output


I've been fighting a few Windows boxes here that are balky with assoc and 
ftype. What I've found is that:

1) You can't have any perl processes open when you run the fype and assoc 
commands.
2) You have to run ftype first and assoc second.
3) You must be an Administrator account when you run the fype and assoc 
commands.
4)*** You must run the fype and assoc commands in a window that your 
started by RIGHT CLICKING A SHORTCUT for cmd.exe and you MUST chose RUN AS 
AN ADMINISTRATOR. Just being an administrator and opening a command window 
is not enough.

ftype PerlScript="C:\Strawberry\perl\bin\perl.exe" "%1" %*
assoc .pl=PerlScript

Obviously, change the path to Perl as per your local install.
--
Matthew O. Persico

Lazard
30 Rockefeller Plaza
New York, NY 10112
212 632 6136




From:   kmx <k...@atlas.cz>
To:     win32-vanilla@perl.org
Date:   04/17/2014 07:53 AM
Subject:        Re: Run an external program and capture its output




On 17.4.2014 13:49, John Emmas wrote:
> On 17/04/2014 11:34, sisyph...@optusnet.com.au wrote:
>> .
>>> This is one that comes up from time to time - it's not specific to 
>>> Strawberry Perl, and has to do with file associations and something 
>>> else .... a registry setting ? ... I can never remember the details, 
>>> nor of how to search for it.
>>
>> Aaah ... here's the solution I was thinking of:
>> http://www.perlmonks.org/?node_id=1024609
>>
>
> Wow, I'm amazed!  I've been programming on Windows for nearly 30 years, 
> yet I never encountered this problem before.  Nevertheless you're 
> absolutely right Rob.  Placing the word "perl" at the start of my 
command 
> line solved the problem!  Sadly, the fix suggested by that article 
didn't 
> work in my case - but no matter, at least I've got a solution now.
>
> One more question - is there a way to obtain the Windows version 
> information using a perl script?  For example, can I obtain the value of 

> WINVER somehow?

Check
https://metacpan.org/pod/Win32#Win32::GetOSDisplayName
and
https://metacpan.org/pod/Win32#Win32::GetOSVersion

--
kmx


Reply via email to