# Use Directory of Executable to find File Paths

**URL:** <https://discourse.processing.org/t/use-directory-of-executable-to-find-file-paths/29790>\
**Category:** Beginners\
**Created:** [May 2, 2021, 3:56pm UTC](https://discourse.processing.org/t/use-directory-of-executable-to-find-file-paths/29790 "2021-05-02T15:56:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CosmicCrowMC](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@CosmicCrowMC](https://discourse.processing.org/u/CosmicCrowMC)\
**Post date:** [May 2, 2021, 3:56pm UTC](https://discourse.processing.org/t/use-directory-of-executable-to-find-file-paths/29790/1 "2021-05-02T15:56:17Z")

</div>

Howdy! I’m trying to do something fairly simple (I think), but can’t find a solution. I’ve made a game with Processing, exported it, and have moved it to a new directory outside of anything in the Processing folder. I run the game from a folder with a .exe and its accompanying asset folders and it works just fine. My problem now, however, is finding the location of the .exe on the computer. I could, of course, use the full file path, something that may look like “C:/games/myGame/save/data.dat”, but then I’d have to change the file path the program looks at every time I move the location of the .exe.

I’m aware you can use sketchPath() for finding the sketch folder the program is using, but I don’t think this works if you move the .exe out of the sketch folder. Is there a way to find the file path the .exe is running from? Maybe something like “(.exe is running in this file path)/save/data.dat”? (This may be more of a Windows Question than a Processing Question, lol)

---

<div class="post-metadata">

**Author:** ![th75](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@th75](https://discourse.processing.org/u/th75)\
**Post date:** [May 2, 2021, 10:04pm UTC](https://discourse.processing.org/t/use-directory-of-executable-to-find-file-paths/29790/2 "2021-05-02T22:04:44Z")

</div>

hi,  
i’m not totally sure i understood what you want to do, but sketchPath() will give you exe path of your sketch (sketch .exe path once compiled) wherever you move it.  
do you use sketchPath("/save/data.dat"); ?
