How to get the absolute path to script that is running?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlanGlynneJones
    New Member
    • Dec 2007
    • 1

    How to get the absolute path to script that is running?

    Hi,

    Probably a really stupid question ...

    Is there some special variable that contains the full path to the directory that the script that is currently running lives in?

    I am running a script from a particular directory but the 'current' directory is the desktop of the user account I'm logged in as, not the one I've run the script from and I want to reference files using a relative path to the directory that the script is in.

    Thanks,

    Alan
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by AlanGlynneJones
    Hi,

    Probably a really stupid question ...

    Is there some special variable that contains the full path to the directory that the script that is currently running lives in?

    I am running a script from a particular directory but the 'current' directory is the desktop of the user account I'm logged in as, not the one I've run the script from and I want to reference files using a relative path to the directory that the script is in.

    Thanks,

    Alan
    If this were a Unix machine, you could look into the process list and see if it was triggered with the full path. But, since this sounds more like a windows machine, I can't help you.

    BTW, it is always a good idea to let people know which OS you are working on.

    Regards,

    Jeff

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      Your question is a bit confusing, look into the Cwd module (comes with perl):

      Comment

      Working...