# Use @\_\_FILE\_\_ in pasted code in REPL

**URL:** <https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 23, 2021, 6:17am UTC](https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824 "2021-02-23T06:17:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 23, 2021, 6:57am UTC](https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824/2 "2021-02-23T06:57:49Z")

</div>

> [@The macrocall @\_\_FILE\_\_ does not return the directory of the file, but rather the REPL output number](https://discourse.julialang.org/t/the-macrocall-file-does-not-return-the-directory-of-the-file-but-rather-the-repl-output-number/55585):
>
> I have been using to following to change my working directory to the location of my .jl scripts in Atom as follows without problems: cd(dirname(@\_\_FILE\_\_)) When I run a script with this in vs code, I get an error and it doesn’t change my working directory: julia\> cd(dirname(@\_\_FILE\_\_)) ERROR: IOError: chdir : invalid argument (EINVAL) Stacktrace: [1] uv\_error at .\libuv.jl:97 [inlined] [2] cd(::String) at .\file.jl:84 [3] top-level scope at REPL[2]:1 The reason that is I think is because …

first result if you search “FILE macro REPL”. Please search before posting, especially that was very much recently asked.

---

_[View the full topic](https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824)._
