in reply to Current Directory in Windows

The "current directory" is not really defined when you start a program via double-clicking. Maybe you want to look at what File::HomeDir or $ENV{USERPROFILE} give you?

Replies are listed 'Best First'.
Re^2: Current Directory in Windows
by Anonymous Monk on Mar 09, 2012 at 14:56 UTC

    The "current directory" is not really defined when you start a program via double-clicking.

    Actually it always appears to be %userprofile%

    so says http://live.sysinternals.com/procexp.exe

    The OP seems confused by about what cwd means, seems OP wants the directory where .exe is located, meaning

    BEGIN { use File::Spec; use File::Basename qw' dirname '; our $thisf = File::Spec->rel2abs(__FILE__); $thisf ||= File::Spec->rel2abs( $0 ); our $thisd = dirname($thisf); }
      bah
      #!/usr/bin/perl -- BEGIN { use File::Spec; use File::Basename(); our $thisf = File::Spec->rel2abs( $0 ); our $thisd = File::Basename::dirname($thisf); }