script path, environment variable
script path, environment variable
(OP)
How can I get the current path of an script.
I'm in a Windows environment and %ENV doesn't have a key for that purpose (or I can't find it).
Mi specific problem is that I want to dynamically include a folder with a path relative to my script.
thanks
I'm in a Windows environment and %ENV doesn't have a key for that purpose (or I can't find it).
Mi specific problem is that I want to dynamically include a folder with a path relative to my script.
thanks
RE: script path, environment variable
"../../file.txt"
"relative/folder/file.txt"
"/absolute/folder/path/file.txt"
This is the syntax in *nix, but it sould work exactly the same in windows.
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
RE: script path, environment variable
# Set the file value
$my_file = "file.ini";
# Get the directory where script.pl is located
$my_directory = dirname($0);
# Set the ini file object
open(SOURCE, "< $my_directory/$my_file");
Thierry