# Get appdata path of current user?

**URL:** <https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495>\
**Category:** UXP Plugin API\
**Created:** [August 12, 2021, 6:26pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495 "2021-08-12T18:26:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![raincole](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/raincole/32/1593_2.png) [@raincole](https://forums.creativeclouddeveloper.com/u/raincole)\
**Post date:** [August 12, 2021, 6:26pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/1 "2021-08-12T18:26:15Z")

</div>

I’d like to access last mesh used by liquify tool. The path on my system is: `C:\\Users\\{my_username}\\AppData\\Roaming\\Adobe\\Adobe Photoshop 2021\\Adobe Photoshop 2021 Settings\\Liquify Last Mesh.psp`. How can I get `my_username` dynamically instead of hardcoding it?

I tried the usual NodeJS way: `process.env.APPDATA`. In a NodeJs session it returns my appdata path, but in a UXP plugin, it’s `undefined`.

---

<div class="post-metadata">

**Author:** ![kerrishotts](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/kerrishotts/32/8_2.png) [@kerrishotts](https://forums.creativeclouddeveloper.com/u/kerrishotts)\
**Post date:** [August 12, 2021, 7:53pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/2 "2021-08-12T19:53:12Z")

</div>

UXP does not support arbitrary file access in this manner, so even if you could get the username, you’d still need to display a file picker to access the location.

You can, however, store a persistent token so that you only need to ask for the above path once.

---

<div class="post-metadata">

**Author:** ![raincole](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/raincole/32/1593_2.png) [@raincole](https://forums.creativeclouddeveloper.com/u/raincole)\
**Post date:** [August 12, 2021, 8:00pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/3 "2021-08-12T20:00:14Z")

</div>

> [@kerrishotts](#):
>
> UXP does not support arbitrary file access in this manner, so even if you could get the username, you’d still need to display a file picker to access the location.
> 
> You can, however, store a persistent token so that you only need to ask for the above path once.

Well technically what I’m trying to do is not direct file access. I’m trying to make an API call:

```auto
const result = await batchPlay(
        [
           {
              "_obj": "$LqFy",
              // Don't know how to get appdata folder dynamically...
              "$LqMD": "C:\\Users\\{username}\\AppData\\Roaming\\Adobe\\Adobe Photoshop 2021\\Adobe Photoshop 2021 Settings\\Liquify Last Mesh.psp",
              "_isCommand": true,
              "_options": {
                 "dialogOptions": "dontDisplay"
              }
           }
        ],{
           "synchronousExecution": false,
           "modalBehavior": "fail"
        });

```

The equivalent is that the user pressing this button during liquify:

 ![Screenshot 2021-08-13 035927](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/7/76d4b3facb640a00ac3ebf993226f25f429522ae.png)

Is it possible?

---

<div class="post-metadata">

**Author:** ![kerrishotts](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/kerrishotts/32/8_2.png) [@kerrishotts](https://forums.creativeclouddeveloper.com/u/kerrishotts)\
**Post date:** [August 12, 2021, 8:03pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/4 "2021-08-12T20:03:47Z")

</div>

Ah, I see.

Does using the `%AppData%` alias – like `%APPDATA%\\Adobe\\...` as the path – work? That way you it would also work in case the application data folder is not on Drive C.

---

<div class="post-metadata">

**Author:** ![raincole](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/raincole/32/1593_2.png) [@raincole](https://forums.creativeclouddeveloper.com/u/raincole)\
**Post date:** [August 12, 2021, 10:13pm UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/5 "2021-08-12T22:13:28Z")

</div>

> [@kerrishotts](#):
>
> Ah, I see.
> 
> Does using the `%AppData%` alias – like `%APPDATA%\\Adobe\\...` as the path – work? That way you it would also work in case the application data folder is not on Drive C.

Well… it doesn’t work for me. When I use

```auto
C:\\Users\\{username}\\AppData\\Roaming\\Adobe\\Adobe Photoshop 2021\\Adobe Photoshop 2021 Settings\\Liquify Last Mesh.psp

```

It works fine. But when I use:

```auto
%APPDATA%\\AppData\\Roaming\\Adobe\\Adobe Photoshop 2021\\Adobe Photoshop 2021 Settings\\Liquify Last Mesh.psp

```

The liquify does nothing.

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [August 13, 2021, 8:48am UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/6 "2021-08-13T08:48:13Z")

</div>

I believe `%APPDATA%` links to `\AppData`, so `%APPDATA%\\AppData\\` part should be just `%APPDATA%\\` 🤔 Or as Kerri suggested, it maybe links even to `\Roaming` - `%APPDATA%\\Adobe\\...`

---

<div class="post-metadata">

**Author:** ![raincole](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/raincole/32/1593_2.png) [@raincole](https://forums.creativeclouddeveloper.com/u/raincole)\
**Post date:** [August 13, 2021, 9:28am UTC](https://forums.creativeclouddeveloper.com/t/get-appdata-path-of-current-user/3495/7 "2021-08-13T09:28:25Z")

</div>

> [@Karmalakas](#):
>
> I believe `%APPDATA%` links to `\AppData` , so `%APPDATA%\\AppData\\` part should be just `%APPDATA%\\` 🤔 Or as Kerri suggested, it maybe links even to `\Roaming` - `%APPDATA%\\Adobe\\...`

Sorry, my mistake. I just checked and it’s `Roaming`:

```auto
>echo %APPDATA%
C:\Users\rainc\AppData\Roaming

```

However, `%APPDATA%\\Adobe\\Adobe Photoshop 2021\\Adobe Photoshop 2021 Settings\\Liquify Last Mesh.psp` still doesn’t work for me either.
