Re: Strange problem with Windows 7 command line and perl
by haukex (Archbishop) on Feb 12, 2017 at 15:13 UTC
|
Hi anonypl,
It's been a while since I had to deal with this kind of problem on Windows, but if memory serves, changes to PATH don't go into effect immediately. So did you already try rebooting? And, if so, what does echo %PATH% (from the same command window in which perl doesn't work) show you?
Regards, -- Hauke D
| [reply] [d/l] [select] |
|
"So did you already try rebooting?"
A reboot isn't required, starting a new instance of the command prompt will work fine.
| [reply] |
Re: Strange problem with Windows 7 command line and perl
by poj (Abbot) on Feb 12, 2017 at 15:06 UTC
|
What do you get using the full path
c:\Users>c:\strawberry\perl\bin\perl -v
poj
| [reply] [d/l] |
Re: Strange problem with Windows 7 command line and perl
by FreeBeerReekingMonk (Deacon) on Feb 12, 2017 at 16:07 UTC
|
You have a 32 bit build, so the information I gave you is wrong.
Try:
1. Run the CMD as Administrator. Maybe it is a permission problem.
old message (wrong information):
I have 5.24.0 and the bug is not there.
(work-machine, sorry not able to install your version to check your bug)
However, when you run a script, it is not run through the PATH but through file association (run extension XYZ with this exe).
So my guess is that you have a 64 bit Perl, but running on a 32 bit CMD prompt
(There is both a 32bit and 64bit version of the command processor (cmd.exe))
The 32 bit version is: C:\Windows\sysWOW64\cmd.exe
| [reply] [d/l] |
Re: Strange problem with Windows 7 command line and perl
by anonypl (Novice) on Feb 12, 2017 at 17:56 UTC
|
Hi
I did start a new instance of command line still the problem persisted. After that, I rebooted and tried again, but the problem was still there. As stated earlier, I dropped to PowerShell and it worked. But the moment I get out of PowerShell, it stops working.
C:\Users\pmu>perl
'perl' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\pmu>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\pmu> perl --version
This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x
+86-multi-thread-64int
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the
GNU General Public License, which may be found in the Perl 5 source ki
+t.
Complete documentation for Perl, including FAQ lists, should be found
+on
this system using "man perl" or "perldoc perl". If you have access to
+ the
Internet, point your browser at http://www.perl.org/, the Perl Home Pa
+ge.
PS C:\Users\pmu> exit
C:\Users\pmu>perl
'perl' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\pmu>
This is something that I truly do not understand. Things are pretty straightforward in linux. I just have to edit the $PATH variable and things generally work consistently. | [reply] [d/l] |
|
Using the "Name" give by your association:
>assoc .pl
.pl=Perl_program_file
Check your registry by running :
>reg query "HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Pro
+gram\command"
Mine shows:
HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program\command
(Default) REG_SZ C:\Strawberry\perl\bin\perl.exe "%1" %*
This will locate the perl binary that ran your ".pl" script.
After that, you need to make sure it is in the PATH.
...it is unhealthy to remain near things that are in the process of blowing up. man page for WARP, by Larry Wall
| [reply] [d/l] [select] |
Re: Strange problem with Windows 7 command line and perl
by anonypl (Novice) on Feb 12, 2017 at 16:18 UTC
|
PS C:\Users\pmu> perl --version
This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x
+86-multi-thread-64int
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the
GNU General Public License, which may be found in the Perl 5 source ki
+t.
Complete documentation for Perl, including FAQ lists, should be found
+on
this system using "man perl" or "perldoc perl". If you have access to
+ the
Internet, point your browser at http://www.perl.org/, the Perl Home Pa
+ge.
PS C:\Users\pmu>
| [reply] [d/l] |
|
| [reply] |
|
Yep. Windows has an 'interesting' way of handling environment variables. One has to go pretty low-level with the Windows API to attempt to make it "Do The Right Thing", but it's just far easier to close the cmd window and open a new one. With that said, similar action can be seen on *nix as well in many cases...
This isn't a Strawberry Perl issue. It'll happen with any software that changes ENV.
| [reply] [d/l] |
Re: Strange problem with Windows 7 command line and perl
by ww (Archbishop) on Feb 12, 2017 at 15:39 UTC
|
Why does the first element in the path you show, 'C:\Strawberry\c\bin;," have a lower_case_c between "Strawberry" and "bin?"
| [reply] [d/l] [select] |
|
It contains gcc make and other Gnu tools to compile cpan modules that are not 'pure perl'.
edit: d'oh... ninja'd
| [reply] |
|
| [reply] |
|
The answer (unless the anon post is not by the OP, anonypl -- which I grant may be the case) in Re: Strange problem with Windows 7 command line and perl re using the FULL (emphasis supplied) path, as suggested by poj, seems to mean that line I asked about is NOT the path to perl.exe, be it strawberry or anything else.
Am I missing something? The path with the intermediate "c" doesn't work here because the path -- unsurprisingly -- can't be found. But that's not the problem in the OP, and the node mentioned in para 1 shows the machine finding perl cheerfully, in the absence of the extra "c."
IOW, I'm not convinced by the parent to which I'm directly replying and FreeReekingBeerMonk's reply, while presumptively accurate, doesn't address the use of a possibly erroneous path to find perl.exe.
| [reply] [d/l] |
|
Re: Strange problem with Windows 7 command line and perl
by Anonymous Monk on Feb 12, 2017 at 15:10 UTC
|
C:\Users\pmu>C:\Strawberry\perl\bin\perl --version
This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x
+86-multi-thread-64int
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the
GNU General Public License, which may be found in the Perl 5 source ki
+t.
Complete documentation for Perl, including FAQ lists, should be found
+on
this system using "man perl" or "perldoc perl". If you have access to
+ the
Internet, point your browser at http://www.perl.org/, the Perl Home Pa
+ge.
C:\Users\pmu>
| [reply] [d/l] |
Re: Strange problem with Windows 7 command line and perl
by anonypl (Novice) on Feb 12, 2017 at 16:13 UTC
|
Hi all
I tried rebooting but that doesn't help. I still have the same problem, though as Marto correctly stated, rebooting is not required. On a side note, thanks for your quick responses. You guys are all helpful.
| [reply] |
|
Ok, what about
c:\Users>ftype perl
and
c:\Users>assoc .pl
poj
| [reply] [d/l] [select] |
|
C:\Users\pmu>ftype perl
File type 'perl' not found or no open command associated with it.
C:\Users\pmu>assoc .pl
.pl=Perl_program_file
C:\Users\pmu>
| [reply] [d/l] |
|