News, tips, advice, support for Windows, Office, PCs & more. Tech help. No bull. We're community supported by donations from our Plus Members, and proud of it
Home icon Home icon Home icon Email icon RSS icon
  • Can’t get MS-Teams to open via batch file

    Posted on Boriscat Comment on the AskWoody Lounge

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

    Tagged: ,

    Viewing 17 reply threads
    • Author
      Posts
      • #2232453 Reply
        Boriscat
        AskWoody Lounger

        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?

      • #2232643 Reply
        Paul T
        AskWoody MVP

        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 1 month, 2 weeks ago by Paul T.
      • #2232734 Reply
        Boriscat
        AskWoody Lounger

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

      • #2232740 Reply
        Boriscat
        AskWoody Lounger

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

         

      • #2232932 Reply
        anonymous
        Guest

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

      • #2232947 Reply
        Boriscat
        AskWoody Lounger

        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 Reply
        anonymous
        Guest

        (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 Reply
          Boriscat
          AskWoody Lounger

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

          • #2233315 Reply
            anonymous
            Guest

            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 Reply
        Paul T
        AskWoody MVP

        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 Reply
        abbodi86
        AskWoody_MVP

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

      • #2233290 Reply
        Boriscat
        AskWoody Lounger

        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 Reply
        Boriscat
        AskWoody Lounger

        %appdata%

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

        • This reply was modified 1 month, 2 weeks ago by Boriscat.
        • #2233440 Reply
          Paul T
          AskWoody MVP

          %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 Reply
        Boriscat
        AskWoody Lounger

        %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 Reply
        BATcher
        AskWoody_MVP

        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

        Data is not the plural of anecdote...

      • #2240595 Reply
        Boriscat
        AskWoody Lounger

        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 Reply
        Paul T
        AskWoody MVP

        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 Reply
        RetiredGeek
        AskWoody MVP

        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 Reply
        Boriscat
        AskWoody Lounger

        I have the answer now, thanks everyone

        • #2241773 Reply
          Paul T
          AskWoody MVP

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

          cheers, Paul

      • #2241796 Reply
        Boriscat
        AskWoody Lounger

        This works fine

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

        1 user thanked author for this post.
    Viewing 17 reply threads

    Please follow the -Lounge Rules- no personal attacks, no swearing, and politics/religion are relegated to the Rants forum.

    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 Advanced BBCodes, they will be stripped before saving.