# Tools: Using env variable in Path

**URL:** https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743
**Category:** Support
**Created:** [December 5, 2024, 6:22pm UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743 "2024-12-05T18:22:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ReefHound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@ReefHound](https://community.mp3tag.de/u/ReefHound)
#### Post date: [December 5, 2024, 6:22pm UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/1 "2024-12-05T18:22:28Z")

</div>

I am using MP3Tag as portable and my tools are also portable. As the drive letter is not consistent, I'm trying to use %PortableApps.comApps% environment variable as base path in Path but it is not working. If I replace this variable with literal path it works. From my Tools ini:

[#2]  
MTTOOLSNAME=SendTo LosslessCut  
MTTOOLSPARAM="%\_path%"  
MTTOOLSPATH=%PortableApps.comApps%\LosslessCutPortable\LosslessCutPortable.exe  
MTTOOLSINST=0

Is it supported but I am doing it wrong?  
Is it not supported but there is an alternate way?  
If not supported and not an easy alternative, can this be added as a wish item?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 5, 2024, 6:25pm UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/2 "2024-12-05T18:25:46Z")

</div>

See the documentation on the scripting function to get environment variables:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#variable-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![ReefHound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@ReefHound](https://community.mp3tag.de/u/ReefHound)
#### Post date: [December 5, 2024, 7:00pm UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/3 "2024-12-05T19:00:14Z")

</div>

Nope, can't get it to work and not sure if scripting is allowed in the path. I've tried

MTTOOLSPATH=$getenv("PortableApps.comApps")\LosslessCutPortable\LosslessCutPortable.exe  
MTTOOLSPATH=$getenv(PortableApps.comApps)\LosslessCutPortable\LosslessCutPortable.exe  
MTTOOLSPATH=$getenv("PortableApps.comApps")+\LosslessCutPortable\LosslessCutPortable.exe

I did find a reasonable workaround using relative path, since I use [PortableApps.com](http://PortableApps.com) and have MP3Tag set up in the standard folder structure where all the app folders are under the same parent. I think this will work even better.  
MTTOOLSPATH=..\LosslessCutPortable\LosslessCutPortable.exe

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 5, 2024, 7:05pm UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/4 "2024-12-05T19:05:41Z")

</div>

As far as I understand it, you set the environment variables outside MP3tag and then reference them with $getenv().  
Here are some examples:

> [@App path in Export target](https://community.mp3tag.de/t/app-path-in-export-target/16124):
>
> How can I get "Export file name" to reference a path relative to Mp3tag.exe? e.g. $filename($getenv(MP3TAGEXEPATH)..\myfile.txt,ANSI) -\> S:\TLIB importing! Curtains\mp3tag..\myfile.txt

---

<div class="post-metadata">

### Author: ![ReefHound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@ReefHound](https://community.mp3tag.de/u/ReefHound)
#### Post date: [December 6, 2024, 12:14am UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/5 "2024-12-06T00:14:36Z")

</div>

I understand that. I am setting the environment variables before launching MP3Tag. I am successfully using $getenv() in other areas. I understand and am using scripting in other custom actions. The issue is using it in the MTTOOLSPATH property of a Tool item.

I am using scripting in the MTTOOLSPARAM property but I've not seen any example of it used in the MTTOOLSPATH property. The MTTOOLSPATH property is set by a file picker in the UI.

[#2]  
MTTOOLSNAME=SendTo LosslessCut  
MTTOOLSPARAM="%\_path%"  
MTTOOLSPATH=..\LosslessCutPortable\LosslessCutPortable.exe  
MTTOOLSINST=0

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [January 5, 2025, 12:14am UTC](https://community.mp3tag.de/t/tools-using-env-variable-in-path/66743/6 "2025-01-05T00:14:41Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
