• Can’t get MS-Teams to open via batch file

    Home » Forums » AskWoody support » Productivity software by function » Other MS apps » Can’t get MS-Teams to open via batch file

    Author
    Topic
    #2232453

    I use Teams daily and although everything else I use in a day opens automatically when I click a batch file, I can’t get Teams to open this way.
    All I want is to add a line to a batch file that opens teams when the batch file is run, does anyone know how to achieve this please?

    Viewing 19 reply threads
    Author
    Replies
    • #2232643

      It seems to be user specific, where you need to change “MyProfile” to your user name.

      C:\Users\MyProfile\AppData\Local\Microsoft\Teams\current\Teams.exe

      cheers, Paul

      • This reply was modified 5 years ago by Paul T.
      • #2406218

        C:\Users\MyProfile\AppData\Local\Microsoft\Teams\current\Teams.exe

        Works as described by Paul T.  Thank you!

    • #2232734

      So I need to have the string as C:\Users\Joe.Bloggs\AppData\Local\Microsoft\Teams\current\Teams.exe?

    • #2232740

      Nope, that doesn’t work at all it just says it can’t find the string

       

    • #2232932

      When you reboot your computer it auto logs in/opens.  Does yours not do this?

    • #2232947

      When you reboot your computer it auto logs in/opens.  Does yours not do this?

      I don’t want to auto login. I need about a dozen apps and files open for work, so I have all of them open from 1 batch script. Teams is the only one I can’t get to work.
      I just want it to open when it is called by a batch script.
      I have one that gets me half way there, but the window comes up with do you wish to allow this program to make changes to your computer, even if I turn UAC all the way off.

    • #2233014

      (2nd anonymous, reading first and comparing)

      Is there already an instance of Teams running? Is it designed to not allow multiple iterations?

      Anonymous above suggests the first question is likely. I ask the second, because I am not familiar with the Microsoft product.

      Separately, is this a security feature rather than a design flaw?

      This could be MS’s first line of defense to malicious code changing your Teams settings.

      • #2233289

        I don’t know if that is the case or not but if it is it is overly controlling.

        • #2233315

          It is a Microsoft application in a Microsoft environment, so yes they have shown to be somewhat controlling in the past.

          It is difficult to trouble shoot a negative. I do not have this program. Have any of these other advisors successfully launched MS Teams from the command line? What syntax was used in this successful example?

          Contrasting failure with success is more informative than guessing.

          (I am #post-2233014)

    • #2233132

      So I need to have the string as C:\Users\Joe.Bloggs\AppData\Local\Microsoft\Teams\current\Teams.exe?

      Open Explorer.
      Enter %appdata% in the location bar and press Enter.

      You will see the path for your user and can navigate to “Local\Microsoft\Teams\current” to confirm teams.exe exists.

      cheers, Paul

      1 user thanked author for this post.
    • #2233196

      %appdata% gives AppData\Roaming
      %localappdata% gives AppData\Local

    • #2233290

      So I need to have the string as C:\Users\Joe.Bloggs\AppData\Local\Microsoft\Teams\current\Teams.exe?

      Open Explorer.
      Enter %appdata% in the location bar and press Enter.

      You will see the path for your user and can navigate to “Local\Microsoft\Teams\current” to confirm teams.exe exists.

      cheers, Paul

      I do know it exists, it works fine. I just need it to work when called from a batch script
      Maybe my question should be, is it possible to write a script that answers yes automatically to a windows popup window?

    • #2233291

      %appdata%

      And no, %appdata% simply leads to roaming, not local folder.

      • This reply was modified 5 years ago by Boriscat.
      • #2233440

        %appdata% gives you the correct user profile. After that it’s easy to change directory.

        is it possible to write a script that answers yes automatically to a windows popup window

        AutoIt or AutoHotKey will do that for you, allowing you to wait for the window you want to send the OK to.
        If you need help writing for either, ask. 🙂

        cheers, Paul

    • #2233629

      %appdata% gives you the correct user profile. After that it’s easy to change directory.

      is it possible to write a script that answers yes automatically to a windows popup window

      AutoIt or AutoHotKey will do that for you, allowing you to wait for the window you want to send the OK to.
      If you need help writing for either, ask. 🙂

      cheers, Paul

      Thanks but installing anotehr program simply to get teams to respond to a bat script seems heavy handed.
      Sadly it looks like am just going to have to carry on as normal 🙁

    • #2240549

      is it possible to write a script that answers yes automatically to a windows popup window?

      Yes – if you really mean Yes or you mean Y

      Try

      echo y | <path to teams>\Teams.exe

      I think you have already found in which folder Teams.exe is situated?  Or have you?

      If so, just plug it in…

      BATcher

      Plethora means a lot to me.

    • #2240595

      is it possible to write a script that answers yes automatically to a windows popup window?

      Yes – if you really mean Yes or you mean Y

      Try

      echo y | <path to teams>\Teams.exe

      I think you have already found in which folder Teams.exe is situated?  Or have you?

      If so, just plug it in…

      Yes I know where teams.exe is.
      So the script would be
      @echo off
      start “Teams” “C:\Users\Gary\AppData\Local\Microsoft\Teams\current\Teams.exe”

      echo y | C:\Users\Gary\AppData\Local\Microsoft\Teams\current\Teams.exe
    • #2240871

      You need to replace the whole teams line with your new command, but if the confirmation dialogue is a GUI it won’t work.

      cheers, Paul

    • #2240917

      Boriscat,

      I’d recommend you setup a scheduled task to run Teams checking the “Run with Highest Privileges” box. Then in your batch file call it like this:

      C:\Windows\System32\schtasks.exe /run /TN "Name of Scheduled Task Here"
      

      Note: there is no need to actually setup a schedule as you’ll be running it “On Demand”

      HTH 😎

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #2240924

      I have the answer now, thanks everyone

      • #2241773

        Please tell us the solution you used – it may help others.

        cheers, Paul

    • #2241796

      This works fine

      CMD /C START “” “C:\Users\{your computer name}\AppData\Local\Microsoft\Teams\current\Teams.exe”
      EXIT

      [Moderator edit] fixed the quotes to allow copy / paste – see below

      CMD /C START "" "C:\Users\{yourcomputername}\AppData\Local\Microsoft\Teams\current\Teams.exe"
      EXIT
      1 user thanked author for this post.
      • #2367485

        Thank you. This is exactly what I was looking for. I am in the same boat as Boriscat. I use a batch file to launch all my primary apps after VPN connection, so can’t just autostart any…

    • #2444427
      CMD /C START "" "%userprofile%\AppData\Local\Microsoft\Teams\current\Teams.exe"
    • #2565460

      Thought i’d get in on this aswell I use

      @echo off

      START “Teams.exe” “C:\Users\{yourcomputername}\AppData\Local\Microsoft\Teams\current\Teams.exe”

       

      Hope this helps!

      • #2604540

        Thank you! It worked for me.

    • #2565487

      Try running the batch file or the CMD prompt as administrator.

      On permanent hiatus {with backup and coffee}
      offline▸ Win10Pro 2004.19041.572 x64 i3-3220 RAM8GB HDD Firefox83.0b3 WindowsDefender
      offline▸ Acer TravelMate P215-52 RAM8GB Win11Pro 22H2.22621.1265 x64 i5-10210U SSD Firefox106.0 MicrosoftDefender
      online▸ Win11Pro 22H2.22621.1992 x64 i5-9400 RAM16GB HDD Firefox116.0b3 MicrosoftDefender
    Viewing 19 reply threads
    Reply To: Can’t get MS-Teams to open via batch file

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: