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"}
In reply to Having a script find itself on the file system in Windows XP and other OSs by David Catchpole
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |