in reply to How to have universal perl script for C and D drive ?
The path to the Program Files directory can be found in the registry at
HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir
The drive in which the script resides can be found using
use File::Spec::Function qw( rel2abs ); my ($drive) = rel2abs($0) =~ /^([A-Z]):/i;
Note that this won't work if the script was launched using a UNC path. ($drive will be undef.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to have universal perl script for C and D drive ?
by jrtayloriv (Pilgrim) on Feb 08, 2008 at 18:03 UTC |