# Run a TOOL Command, based on selection, in a SINGLE WINDOW

**URL:** https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787
**Category:** Support
**Created:** [January 7, 2022, 9:39am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787 "2022-01-07T09:39:35Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 7, 2022, 9:39am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/1 "2022-01-07T09:39:35Z")

</div>

I was hoping if someone could help me: I am using MP3Tag & mkvpropedit, via MP3Tag GUI Tool option (please see attachment), in order to retain the Encoded date within this parameter:

**--edit info --set date="%creation\_time%" "%\_path%"**

The command does as intended but my issue is that once I run the tool on the files that I selected, multiple windows show up, instead of a SINGLE window handling the same command for the selected files.

Basically, I want to know if there is an additional code that I can add into the parameter that would either hide the terminal or force that one action into a single command window terminal? For example, from the image shown below, it's insane how all 25 different Windows appear just to execute that one command on 25 files, when it should be able to do that in a single windows based upon my selection.

I will appreciate the help or advice from anyone.

 ![MP3Tag_20220106_225012.mp4_snapshot_00.17_2022.01.06_22.53](https://community.mp3tag.de/uploads/default/original/2X/a/af07ecbedb423ff1c4c87909bf64bf15df0da58b.jpeg)

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 7, 2022, 9:56am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/2 "2022-01-07T09:56:10Z")

</div>

I guess, that this is up to your called external tool (`mkvpropedit`).

Mp3tag just execute your defined command line per selected track.  
I suggest that you find a way how mkvpropedit close it's own window after successfull execution.  
Maybe something that make use of the [exit codes](https://mkvtoolnix.download/doc/mkvpropedit.html#d4e1074)?

Or maybe you could write an external cmd batch file with the help of the Mp3tag export function?

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 7, 2022, 9:56am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/3 "2022-01-07T09:56:16Z")

</div>

Maybe this thread gives you some informations:

> [@passing multiple selected items to external tool](https://community.mp3tag.de/t/passing-multiple-selected-items-to-external-tool/16451):
>
> Okay so I am adding xrecodeII.exe as an external tool. It has a fairly rich set of command line invocation options. [http://xrecode.com/cmdline.txt](http://xrecode.com/cmdline.txt) I am invoking it thusly at the moment /sendto "%\_path%" but that means xrecode can only receive one item at a time from mp3tag. I need it to receive all selected items. I also have implemented /sendto "%\_folderpath%" but that gets me the whole folder (something separate to what I am looking for). I didn't spot any scripting functions that wou…

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 7, 2022, 8:56pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/4 "2022-01-07T20:56:14Z")

</div>

thanks for responding. I tried the exit code method, but it was unsuccessful, unless I am doing something incorrectly below because the command didn't work.

**--edit info --set date="%creation\_time%" "%\_path%" --if %errorlevel% equ 1**

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 7, 2022, 8:58pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/5 "2022-01-07T20:58:47Z")

</div>

I appreciate the response as well, but I am unsure regarding how to create an MTE file regarding the command line I want to include. Any way you can help me since my task is just one line?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 7, 2022, 8:59pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/6 "2022-01-07T20:59:05Z")

</div>

In the meantime I have used your command line on my own tracks.  
I can see the window popping up for less then a second on my system, closing itself after making the changes.

Unfortunatley I can't say, why the windows remain open in your case...

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 7, 2022, 9:02pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/7 "2022-01-07T21:02:22Z")

</div>

It seems that the MTE is the only method for me try, but I have no idea how to code it regarding the parameters. Moreover, I also appreciate that you had the same issue that I promised regarding MP4 metadata because I thought that I was the only one:

> [@MP4: Explorer File Properties Fields: "Subtitle," "Tags," "Directors," "Producers," "Writers," "Publisher," "Content provider," "Encoded by," "Author URL," "Promotion URL," and "Parental rating."](https://community.mp3tag.de/t/mp4-explorer-file-properties-fields-subtitle-tags-directors-producers-writers-publisher-content-provider-encoded-by-author-url-promotion-url-and-parental-rating/54774):
>
> I was wondering if someone can help me regarding creating a field that directly reflects Windows Explorer File Properties for MP4 files. When I use MetaX on an MP4 file, any entry added into the "Director," "Producers," "Screenwriters," "Rating," "Subtitle" and "Stars" fields is directly pushed into the Windows Explorer File properties. I want to apply that same settings on MP3Tag for MP4 files, if possible. I also want to fields for "Publisher," "Content provider," "Encoded by," "Author URL,…

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 7, 2022, 9:16pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/8 "2022-01-07T21:16:44Z")

</div>

Do I understand you correctly:  
The `mkvpropedit` window (per selected track) is visible only a short time and then disappear automatically for you?  
Or do they remain open until you close it manually?

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 7, 2022, 9:35pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/9 "2022-01-07T21:35:33Z")

</div>

They're visible only for a short time and then disappear, but the issue was that I wasn't aware about it, especially when I selected over 150 files to process at once that almost crashed the computer lol

---

<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: [January 8, 2022, 8:28am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/10 "2022-01-08T08:28:02Z")

</div>

> [@wneclass2018](#):
>
> It seems that the MTE is the only method for me try, but I have no idea how to code it regarding the parameters.

Create a new export with soemthing like

```auto
$filename(mkvbat.txt,utf-16) $loop(%_filename%)mkvpropedit --edit info --set date="%creation_time%" "%_filename%"
$loopend()

```

Run the script and then rename the resulting TXT file to BAT and execute it in a command shell window.  
A word of warning: I have no clue whether the command line itself is correct. You have to test it - and then perhaps tell us whether and how it worked.

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 8, 2022, 9:38pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/11 "2022-01-08T21:38:12Z")

</div>

Thanks, but it didn't work

---

<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: [January 8, 2022, 9:40pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/12 "2022-01-08T21:40:25Z")

</div>

It is always MUCH easier if the statements about working or not working functions are a LOT more detailed.  
Like  
What did you do to create the export?  
Did you get any error messages?  
Which step did not work?

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 8, 2022, 9:45pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/13 "2022-01-08T21:45:26Z")

</div>

My apologies. I did as instructed, and the text file produced:

**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E01"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E02"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E03"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E04"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E05"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E06"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E07"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E08"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E09"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E10"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E11"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E12"**  
**mkvpropedit --edit info --set date="2009-12-25T12:25:30Z" "The Fresh Prince of Bel-Air (1990) S03E13"**

Then, I changed the file extension to .bat, and ran the script. The dates weren't changed, post running the .bat

---

<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: [January 8, 2022, 9:48pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/14 "2022-01-08T21:48:06Z")

</div>

So, did you check the syntax for your tool?  
I mean, the script itself produced a valid output right?  
Which messages did you get when running the batch file?

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 8, 2022, 9:56pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/15 "2022-01-08T21:56:22Z")

</div>

There was no message: command window opened and closed rapidly. Nonetheless, I have never ran a .bat file without adding the directory, along with other necessary components, below, which is why I am confused on how to proceed:

\*\*for %%x in (\*.mkv _.mka .mks) do "C:\Program Files\MKVToolNix\mkvpropedit.exe" "%%x"_

---

<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: [January 8, 2022, 9:58pm UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/16 "2022-01-08T21:58:43Z")

</div>

you could open a command shell in the folder where the bat file is located.  
Then run the batch file from the command shell prompt.

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 9, 2022, 12:08am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/17 "2022-01-09T00:08:29Z")

</div>

Apologies, but I was unable to comprehend what you asked of me, but, with one draw back, in which I will elaborate on, I did manage to figure it out via a previous post, provided by @poster, [passing multiple selected items to external tool - #3 by tezza](https://community.mp3tag.de/t/passing-multiple-selected-items-to-external-tool/16451/3)

The only draw back, from the MTE below, is that I can only process/export one file at a time, regardless of when I select the files I want processed or not. Moreover, I created an "ACTION" which did not work at all, for some reason. Anyway, you or anyone in this post can tell me what I am missing in the attacked .mte below

[mkvpropedit\_set creation time to encoded time.mte](https://community.mp3tag.de/uploads/short-url/30iU3Q3IhgCWWdbY7H2SB5YytZJ.mte) (2.0 KB)

---

<div class="post-metadata">

### Author: ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)
#### Post date: [January 9, 2022, 1:01am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/18 "2022-01-09T01:01:11Z")

</div>

> [@wneclass2018](#):
>
> The only draw back, from the MTE below, is that I can only process/export one file at a time

I am the author of the script you used.  
It was written to execute an application that allows multiple files as command line arguments.  
But I believe that mkvpropedit allows only 1 file on it's command line.  
I have attached a modified script to execute mkvpropedit, once for each file.  
[1Tools\_\_\_Execute\_Application-multiple\_times\_once\_for\_each\_file.mte](https://community.mp3tag.de/uploads/short-url/wkzB2jkS4EtdVXcy3GKH4DXE2Qn.mte) (1.8 KB)

However, there is minimal error-handling or notification of success or failure.

Maybe you would rather use the simpler script as described by @ohrenkino.  
If so, take note of the following modifications:

- Unless mkvpropedit is in your path, you must use the fully qualified path, for example:  
`"C:\Program Files\MKVToolNix\mkvpropedit.exe"`

- Also, I believe that mkvpropedit command lines expect a MKV file, for example: `"C:\any path\to\movie.mkv"`  
In Mp3tag, the placeholder is `%_path%`.

- The BAT file will not execute if encoded with UTF-16. Use UTF-8 instead, as shown.

```auto
$filename($getEnv(USERPROFILE)\Desktop\mkv.bat,utf-8)$loop(%_path%)"C:\Program Files\MKVToolNix\mkvpropedit.exe" --edit info --set date="%creation_time%" "%_path%"
$loopend()
pause

```

This will create a BAT file on the Desktop that will execute if you click "Yes" when Mp3tag asks "Display Export file now?".  
(Make sure you show a message when exporting tags: Options \> Messages \> check-mark "at exporting tags")

---

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 9, 2022, 2:15am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/19 "2022-01-09T02:15:50Z")

</div>

Thank you. IT WORKED PERFECTLY. Likewise, @ohrenkino, thank you as well: I guess I was confused because the file path was for mkvpropedit was absent, and I have never used an MTE file. Nonetheless, @ryerman, could you explain to me why the MTE file doesn't work when an create an Action for it?

---

<div class="post-metadata">

### Author: ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)
#### Post date: [January 9, 2022, 4:54am UTC](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787/20 "2022-01-09T04:54:24Z")

</div>

> [@wneclass2018](#):
>
> why the MTE file doesn't work when an create an Action for it?

When an "Export" is performed using the menu on the toolbar, there is the opportunity to "display" the file that is created.  
But what actually happens is that the file is opened (ie executed) by whatever default application is associated with the created file type, given by the extension.  
That happens if you click "Yes" when Mp3tag asks "Display Export file now?"  
So a BAT file would be executed by the Command window, a TXT file might be opened by Notepad, a VBS file might be opened by the Wscript script engine, etc.

When an export is used as an action, Mp3tag does not ask the question "Display Export file now?" and there is no opportunity to display/execute/run the created export file.

If you must use an action to perform an export, you can always create the exported file in a convenient place (like the Desktop), and open it manually.

Did you try the 3 line export script in my previous post?

[Next page](https://community.mp3tag.de/t/run-a-tool-command-based-on-selection-in-a-single-window/55787.md?page=2)
