Jump to content
  • Windows 10 Forums

    Welcome to the Windows 10 forums, a free community where people just like you come together to discuss, share and learn how to use their computers.

    As a guest, you can browse and view all the content on the site, however, you won't be able to leave comments or create new topics unless you create a free account. 

Problem with command script


GaryFin
Go to solution Solved by tao,

Recommended Posts

I have a command script that runs that opens several webpages and programs automatically. It's worked great for years but lately it stops and throws an error message saying:

(node:9804) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 appInitialized listeners added. Use emitter.setMaxListeners() to increase limit

Does anyone know what this means or what I ought to do about it?

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Same here.

I made a small batch file to open several programs when I arrive at work. One of them is Microsoft Teams. It started returning this precise error when I changed from the web app to the desktop app.

Before (no errors):

## Start.bat
ECHO Starting Microsoft Edge - Teams Web App
START "" /B microsoft-edge:
PAUSE

## Output
Starting Microsoft Edge - Teams Web App

Press any key to continue . . .

After (error "MaxListenersExceededWarning"):

## Start.bat
ECHO Starting Microsoft Teams
START "" /B "C:\Users\T\AppData\Local\Microsoft\Teams\current\Teams.exe"
PAUSE

## Output
Starting Microsoft Teams

Press any key to continue . . .
(node:11632) MaxListenersExceededWarning: Possible EventEmitter memory leak
detected. 11 appInitialized listeners added. Use emitter.setMaxListeners()
to increase limit

All answers I've seen are Javascript related, which is rather useless, as I do not control whatever Javascript is being called or its parameters.

Any help is welcome.

tao

Link to comment
Share on other sites

  • 1 month later...
  • 8 months later...

Hi,

I have the same problem,  found that you cannot start teams directly using the "current\Teams.exe" file with cmd or powershell.

So I now use the following:

%LOCALAPPDATA%\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "--system-initiated"

 

Hopefully this will help you as well tao :)

Link to comment
Share on other sites

  • Solution

Hi Paulus,

I discovered that it was possible to launch Teams using cmd IF the window closed before the dump occurred (go figure!). For instance, if it closes immediately after starting Teams, i.e, no other commands nor PAUSE are given afterwards.

After several tries, I've managed a rather convoluted solution, using 2 batch scripts.

Main script:

## Start.bat
ECHO Starting Microsoft Teams
START "" /B "Teams.bat"
PAUSE
---------------------------------
## Output
Starting Microsoft Teams

Press any key to continue . . .

Secondary script:

## Teams.bat
CMD /C START "" "C:\Users\TAO\AppData\Local\Microsoft\Teams\current\Teams.exe"
EXIT
---------------------------------
## Output
n/a

See if this helps, because Teams certainly doesn't.

tao

Link to comment
Share on other sites

  • 3 weeks later...
On 3/24/2020 at 10:01 AM, Paulus said:

Hi,

I have the same problem,  found that you cannot start teams directly using the "current\Teams.exe" file with cmd or powershell.

So I now use the following:

%LOCALAPPDATA%\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "--system-initiated"

 

Hopefully this will help you as well tao :)

This works but you still get the screen asking if I want Teams to make changes to my computer, even if I turn UAC off. Grr
Is there a way around that?

Link to comment
Share on other sites

1 hour ago, GaryFin said:

This works but you still get the screen asking if I want Teams to make changes to my computer, even if I turn UAC off. Grr
Is there a way around that?

Hi Gary

See my reply to Paulus.

Mostly, I kept my main script the same, with all the programs I want started.
But instead of trying to start Teams directly, the main script now calls another script which, in turn, starts Teams.

Hope it helps.

Link to comment
Share on other sites

On 3/24/2020 at 1:03 PM, tao said:

Hi Paulus,

I discovered that it was possible to launch Teams using cmd IF the window closed before the dump occurred (go figure!). For instance, if it closes immediately after starting Teams, i.e, no other commands nor PAUSE are given afterwards.

After several tries, I've managed a rather convoluted solution, using 2 batch scripts.

Main script:


## Start.bat
ECHO Starting Microsoft Teams
START "" /B "Teams.bat"
PAUSE
---------------------------------
## Output
Starting Microsoft Teams

Press any key to continue . . .

Secondary script:


## Teams.bat
CMD /C START "" "C:\Users\TAO\AppData\Local\Microsoft\Teams\current\Teams.exe"
EXIT
---------------------------------
## Output
n/a

See if this helps, because Teams certainly doesn't.

tao

I'm not sure what that is supposed to do but all the main script does here is opens a command prompt of my desktop

Link to comment
Share on other sites

On 4/9/2020 at 12:41 PM, GaryFin said:

I'm not sure what that is supposed to do but all the main script does here is opens a command prompt of my desktop

Hi GaryFin

In the example above, I named both scripts as follows:
Main script . . . . .: Start.bat
Secondary script: Teams.bat

So that line in the main script calls the secondary one, which, in turn, opens MS Teams (without hanging).

Cheers,
tao

Link to comment
Share on other sites

17 hours ago, GaryFin said:

but you have a line that says press any key? So the work to run the script and then press any key, which is the equivalent of double clicking teams? Which is what I wish to avoid.

No, I don't have a line that says "press any key".

From the beginning, for each script, I entered both the code AND the generated output.
I prefixed each section with "##" and separated them with "--------", to make it more easily identifiable, but apparently it wasn't.

The script itself ends just before the "--------".
The PAUSE instruction is responsible for the output line "Press any key to continue . . .", but that is my choice.

## script_name
This is the script code itself and it ENDS HERE.
---------------------------------
## Output
This is the generated OUTPUT, so one can analyse/troubleshoot it.

 

  • Upvote 1
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Who's Online   0 Members, 0 Anonymous, 12 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...