# Getting START /WAIT to work when app already running

**URL:** https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191
**Category:** Support
**Created:** [November 11, 2013, 10:11pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191 "2013-11-11T22:11:47Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 11, 2013, 10:11pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/1 "2013-11-11T22:11:47Z")

</div>

Anyone know how to get /WAIT on the START command to work when Mp3tag is already running?

My batch file uses

```
 START "" /WAIT "%~dp0tools\Mp3tag\Mp3tag.exe" /fp:"temp\"

```

to run Mp3tag and wait for completion before for processing commands, but it fails to wait if Mp3Tag is already running.

Thanks.

---

<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: [November 12, 2013, 6:20am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/2 "2013-11-12T06:20:45Z")

</div>

I think this is only possible if you have several start commands in the same batch file.  
If you try to open several instances of MP3tag then it is not possible as theses instances start independently from each other and then discover that there is already an instance running.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 12, 2013, 10:41am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/3 "2013-11-12T10:41:49Z")

</div>

Thanks. I'm not trying to open several instances. I'm trying to open a single instance in this batch file. The failure occurs if there is already in instance open when the batch file starts.

---

<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: [November 12, 2013, 10:48am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/4 "2013-11-12T10:48:13Z")

</div>

If you start the batch file and there is already an open MP3tag then you do open several instances.  
The batch file only knows abouts its very local environment so that one command in the chain can listen to the response of the previous command.  
Everything that runs outside this environment is not under control of the batch process.  
So as it is not possible to start several instances of MP3tag any attempt to start another instance will fail.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 12, 2013, 10:57am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/5 "2013-11-12T10:57:02Z")

</div>

> [@ohrenkino](#):
>
> If you start the batch file and there is already an open MP3tag then you do open several instances.

I don't see several instances. I see the batch file command take control of the existing instance.

> [@ohrenkino](#):
>
> So as it is not possible to start several instances of MP3tag

Agreed.

> [@ohrenkino](#):
>
> any attempt to start another instance will fail.

If it completely failed, I'd be happy! Instead it takes control of the existing instance and the /WAIT fails.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 12, 2013, 11:12am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/6 "2013-11-12T11:12:27Z")

</div>

> [@chrisjj](#):
>
> ... I see the batch file command take control of the existing instance. ...

Mp3tag is a windows application but not a command line application.  
Once Mp3tag has been started from the command line, the windows process get its own environment and has no further binding to the command process.  
Furthermore Mp3tag checks itself if it has been started again.  
Mp3tag only takes the new process's parameters, kills the new process, and updates itself with the new parameters.

DD.20131112.1313.CET

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 12, 2013, 11:18am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/7 "2013-11-12T11:18:09Z")

</div>

> [@DetlevD](#):
>
> Once Mp3tag has been started from the command line, the windows process get its own environment and has no further binding to the command process.

That's not what I see. When START /WAIT works, it works.

> [@DetlevD](#):
>
> Furthermore Mp3tag checks itself if it has been started again. Mp3tag only takes the new process's parameters, kills the new process, and updates itself with the new parameters.

That's certainly consistent with the problem I am having.

If anyone knows a solution, please do say. E.g. a command utility proven to reliably terminate Mp3tag.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 12, 2013, 11:50am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/8 "2013-11-12T11:50:43Z")

</div>

> [@chrisjj](#):
>
> That's not what I see. When START /WAIT works, it works. ...

Yes, my bad, you are right.

For example ...  
START "" /WAIT notepad.exe  
... will wait until notepad has been closed.

That's the same when starting Mp3tag.exe.

Huh, what was the problem, please?  
Ah yes I see, the new still invisible Mp3tag process will be killed immediately.  
And the command script takes the next step.

You can look for a running Mp3tag process ... and if exist, then kill it.

pslist.exe "Mp3tag" -e 1\>NUL 2\>NUL

IF %ERRORLEVEL%==0 (ECHO.Mp3tag is running.) ELSE (ECHO.Mp3tag is not running.)  
IF %ERRORLEVEL%==0 (pskill.exe "Mp3tag" 1\>NUL 2\>NUL)

 

You can find pslist.exe and pskill.exe from the Sysinternals suite there ...  
[http://download.sysinternals.com/files/PSTools.zip](http://download.sysinternals.com/files/PSTools.zip)

 

DD.20131112.1440.CET

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 14, 2013, 12:03am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/9 "2013-11-14T00:03:13Z")

</div>

> [@DetlevD](#):
>
> Ah yes I see, the new still invisible Mp3tag process will be killed immediately.  
> And the command script takes the next step.

Yup, that's it.

> [@DetlevD](#):
>
> Maybe you can try pskill.exe from the Sysinternals suite.

Thanks. That works. Which is a surprise, since nowhere do I see that pslist is supposed to set %errorlevel%.

Kill loses any unsaved work in the app, so I decided to pause instead:

```
pslist.exe "Mp3tag" -e 1>NUL 2>NUL
REM If Mp3tag already running, manually close before proceeding.
If %ERRORLEVEL%==0 (pause)

```

Thanks again. This is a big improvement, because it also prevents that command Mp3tag.exe running a different and incompatible version of the app (I have both V2.44 and later) which was occasionally causing false metadata.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 14, 2013, 12:30am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/10 "2013-11-14T00:30:19Z")

</div>

> [@chrisjj](#):
>
> Yup, that's it. Thanks. That works. Which is a surprisae, since nowhere do I see that pslist is supposed to set %errorlevel%. ... Thanks again. This is a big improvement, because it also prevents that command Mp3tag.exe running a different and incompatible version of the app (I have both V2.44 and later) which was occasionally causing false metadata.

I'm glad to help you.  
Hmm ... you may rename Mp3tag.exe version 2.44 to another name like "Mp3tag244.exe" and run it under that name, so you can see it in the processlist with that name and decide what to do.  
Renaming seems not to change the behaviour of Mp3tag killing the second invocation.

DD.20131114.0230.CET

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 14, 2013, 12:55am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/11 "2013-11-14T00:55:58Z")

</div>

> [@DetlevD](#):
>
> you may rename Mp3tag.exe version 2.44 to another name like "Mp3tag244.exe" and run it under that name, so you can see it in the processlist with that name and decide what to do.

Yes, that would be even safer - thanks.

> [@DetlevD](#):
>
> Renaming seems not to change the behaviour of Mp3tag killing the second invocation.

I would like a patch to the .exe for this. I see no good reason for Mp3tag preventing me running it twice from separate portable installs.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 14, 2013, 8:33pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/12 "2013-11-14T20:33:43Z")

</div>

I just tried it and what you had originally works for me in Windows7 Pro. My batch file consists of the following:

```
start /wait mp3tag.exe /fp:"D:\Music\! Test\Flac\Alison Krauss\Two Highways"
start /wait mp3tag.exe /fp:"D:\Music\! Test\Flac\Freddie Hubbard\Rollin'"

```

The behavior that I see is that Mp3tag opens with the Alison Krauss album. When Mp3tag is closed, it then opens again with the Freddie Hubbard album. I assume that's what you want.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 14, 2013, 9:02pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/13 "2013-11-14T21:02:15Z")

</div>

> [@JJ Johnson](#):
>
> I assume that's what you want.

Thanks but it is not. I asked "Anyone know how to get /WAIT on the START command to work when Mp3tag is already running?" and if you try your example **_when Mp3tag is already running_** you'll see your /WAIT fails.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 14, 2013, 9:08pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/14 "2013-11-14T21:08:26Z")

</div>

Ah, yes. I didn't understand that part. It would never have occurred to me that closing Mp3tag first would be too much trouble.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 14, 2013, 9:19pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/15 "2013-11-14T21:19:39Z")

</div>

> [@JJ Johnson](#):
>
> I wouldn't have thought that closing Mp3tag first never occurred to you, or was too much trouble. I should have known better by now.

Again, see [/t/15071/1](https://community.mp3tag.de/t/15071/1) .

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 7, 2014, 1:16am UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/16 "2014-08-07T01:16:38Z")

</div>

This fails on Win7:

```
R:\>Mp3tag.exe
R:\>pslist.exe /accepteula "Mp3tag" -e 1>NUL 2>NUL
R:\>REM if Mp3tag already running, manually close before proceeding.
R:\>If 9009 == 0 (pause)

```

Any ideas?

EDIT: My mistake. A PATH error meant the .exe was not found. But "2\>NUL" hid the error message! Dangerous. So I have removed it.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 12, 2014, 10:25pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/17 "2014-08-12T22:25:46Z")

</div>

D, here's a solution using only internal commands, and no risky 2\>nul:

```
REM Ensure Mp3tag is closed - loop while running
:checkmp3tag
tasklist /fi "imagename eq Mp3tag.exe" | find "Mp3tag.exe" 1>nul
If %ERRORLEVEL%==0 (cls & echo Close Mp3tag! & goto checkmp3tag)
```

---

<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: [February 9, 2026, 12:24pm UTC](https://community.mp3tag.de/t/getting-start-wait-to-work-when-app-already-running/15191/18 "2026-02-09T12:24:45Z")

</div>


