David Catchpole has asked for the wisdom of the Perl Monks concerning the following question:
Now, problem with this is that it sets as the current working directory the directory (e.g. C:/WINDOWS/) I launched the command from, rather than the directory (e.g. C:/My Documents/David/) where the script resides, which I would like to have on hand in order to play with other files that live in its neighbourhood. I guess I'd also like to have fully portable code that's prepared for any reasonable method of launch, and so I think this is an issue that can't be resolved just by changing my own behaviour. Previously I was using Windows 98SE and I'd gone some way to solving the problem by stripping the script path fromC:\WINDOWS>perl c:\mydocu~1\david\somescript.pl
... but now I'm using Windows XP, which don't got$ENV{"CMDLINE"}
or anything similar! Is there any consistent way of getting the full shell command line, or more generally of getting a script to find itself on the file system? Also, what issues does this have for portability to non-Windows OSs?$ENV{"CMDLINE"}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Having a script find itself on the file system in Windows XP and other OSs
by Anonymous Monk on Feb 24, 2004 at 23:24 UTC | |
by David Catchpole (Initiate) on Feb 24, 2004 at 23:39 UTC | |
|
Re: Having a script find itself on the file system in Windows XP and other OSs
by matija (Priest) on Feb 25, 2004 at 08:02 UTC |