# Finding the path to the file being executed

**URL:** https://discourse.julialang.org/t/finding-the-path-to-the-file-being-executed/10905
**Category:** General Usage
**Created:** [May 15, 2018, 9:27am UTC](https://discourse.julialang.org/t/finding-the-path-to-the-file-being-executed/10905 "2018-05-15T09:27:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)
#### Post date: [May 15, 2018, 9:27am UTC](https://discourse.julialang.org/t/finding-the-path-to-the-file-being-executed/10905/1 "2018-05-15T09:27:49Z")

</div>

I am creating a install.jl script to install my software on my user’s computer: all necessary stuff is packed in a zip file, the user can unzip it into some folder Drive:\path, and is invited to execute Drive:\path\install.jl. install.jl will do some setting up. To that effect, I need my script to find out the value of “Drive:\path”. pwd() is not what I want, because it is not affected by executing a given file.

Any trick?

🙂

Philippe

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [May 15, 2018, 9:31am UTC](https://discourse.julialang.org/t/finding-the-path-to-the-file-being-executed/10905/2 "2018-05-15T09:31:02Z")

</div>

Take a look at `@ __FILE__ ` and `@ __DIR__ `:

```julia
help?> @ __FILE__
  @ __FILE__ -> AbstractString

  @ __FILE__ expands to a string with the path to the file containing the
  macrocall, or an empty string if evaluated by julia -e <expr>. Returns
  nothing if the macro was missing parser source information. Alternatively
  see PROGRAM_FILE.

help?> @ __DIR__
  @ __DIR__ -> AbstractString

  @ __DIR__ expands to a string with the absolute path to the directory of the
  file containing the macrocall. Returns the current working directory if run
  from a REPL or if evaluated by julia -e <expr>.

```

---

<div class="post-metadata">

### Author: ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)
#### Post date: [May 15, 2018, 10:20am UTC](https://discourse.julialang.org/t/finding-the-path-to-the-file-being-executed/10905/3 "2018-05-15T10:20:48Z")

</div>

Spot on Frederik, thank you!
