Re: Finding "this file name".



Howard Charles wrote:
> This is very strange.
>
> The following works just fine:
>
> #!/usr/local/bin/perl -w -l
> use FindBin;
> print 'This path name: '.Win32::GetLongPathName($FindBin::Bin);
> print 'This file name: '.Win32::GetLongPathName($FindBin::Script);
> __END__
>
> ...but when I execute the same two statements as two separate DOS
> commands in a .bat file (Windows ME) as follows:
>
> perl -MFindBin -le "print 'This path name:
> '.Win32::GetLongPathName($FindBin::Bin)"
> perl -MFindBin -le "print 'This file name:
> '.Win32::GetLongPathName($FindBin::Script)"
>
> ...the first DOS command works, but the second one doesn't! The second
> one prints a null string for the
> "Win32::GetLongPathName($FindBin::Script)"!

I'm confused as to what you were expecting to happen. That code is in
a one-liner. There is no script, and therefore no script name. In this
case, Perl will report the script name as "-e", since the code is
coming from a -e command line switch. Passing that to GetLongPathName
results in an empty string, as Windows has know knowledge of any path
named "-e".

What value were you hoping for this code to produce?

Paul Lalli

.



Relevant Pages

  • Re: batch file to delete files based on criteria
    ... The Advanced Version of Snapshot will create date/time coded backups that ... This script is included with the FREE Advanced NT/2K/XP/K3 Command Library ... script will perform CONSISTENTLY under Windows NT4, 2000, XP and Server ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: WshShell.Exec output read impossible until command finished
    ... I've done a script to force remove of old DCs. ... I'm using NTDSUTIL command line tool for that, ... How can I have a live output read (like under Windows 2003 DC)? ...
    (microsoft.public.scripting.vbscript)
  • Re: Command line cannot fwrite, browser can
    ... Using the command line, the script gives a warning, and then fails saying ... Classic windows permission issue. ...
    (comp.lang.php)
  • Re: Swap/Remap Ctrl and Alt keys.......Finally
    ... startup/login script. ... It shows a message saying you need to add a line to a login script to ... The back quotes mean that the output of the "uname -n" command shall be ... options are much more comprehensive that those in Windows (does Windows ...
    (Ubuntu)
  • Re: Windows 2000 remote login problems
    ... Whenever a user forgets their Windows password we ... When the user forgets his password, he logs on with the user Setpassword. ... and the script asks for the user name to reset as well as the ... Changing password from a script (vbscript as well as command line): ...
    (microsoft.public.win2000.security)