Announcement

Collapse
No announcement yet.

login.bat cmd window will not close after it runs

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • login.bat cmd window will not close after it runs

    I'm running a login.bat file on a Windows 2003 server, the .bat is being run from the user profile/Login Script field. After it runs the cmd windows does not close and must be closed manually by the user.

    Anybody have any thougts?

  • #2
    Re: login.bat cmd window will not close after it runs

    Depending on what the batch file does, it may not close, so depending on how much of your batch file you want to reveal, would you consider posting the batch file here for us to have a look at?
    Best wishes,
    PaulH.
    MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

    Comment


    • #3
      Re: login.bat cmd window will not close after it runs

      One possibility is that the last command in the file starts a program that's either a TSR or is something that never terminates. One way that should fix the problem is to prefix the last command that launches a program with the START command, and using the /B option, and then adding an EXIT statement, as appears in the following:

      Code:
      START /B drive:\path\program.exe
      EXIT
      Steve
      (aka sgmunson)

      Comment


      • #4
        Re: login.bat cmd window will not close after it runs

        Here's the login.bat, very simple by comparison to many others, just freeing up drive mappings and resetting them. I had already put the 'EXIT' command at the end with no positive results.

        net use f: /delete
        net use h: /delete
        net use j: /delete
        net use k: /delete
        net use l: /delete
        net use n: /delete

        net use f: \\xxx-fs1\Novell_SRV_BAK
        net use h: \\xxx\apps
        net use j: \\xxx-fs1\Users
        net use k: \\xxx-fs1\Apps
        net use l: \\xxx-fs1\admins
        net use n: \\xxx-fs1\Timeclock
        exit

        Comment


        • #5
          Re: login.bat cmd window will not close after it runs

          Hmmmm that's rather odd, as I haven't used the EXIT command at the end of batch files that have only NET USE in them and they still close. So there may be a file called exit.exe somewhere on the path, but that is just a wild guess. To check, does the batch file close if you remove the EXIT command?

          Also, are you certain it is this batch file that is still open, and not just another command window that has come from somewhere else?

          I am really scraping the barrell for ideas on this one as I find it very puzzling indeed!
          Best wishes,
          PaulH.
          MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

          Comment


          • #6
            Re: login.bat cmd window will not close after it runs

            Originally posted by Biterror View Post
            Here's the login.bat, very simple by comparison to many others, just freeing up drive mappings and resetting them. I had already put the 'EXIT' command at the end with no positive results.

            net use f: /delete
            net use h: /delete
            net use j: /delete
            net use k: /delete
            net use l: /delete
            net use n: /delete

            net use f: \\xxx-fs1\Novell_SRV_BAK
            net use h: \\xxx\apps
            net use j: \\xxx-fs1\Users
            net use k: \\xxx-fs1\Apps
            net use l: \\xxx-fs1\admins
            net use n: \\xxx-fs1\Timeclock
            exit
            Is this the complete batch?
            Are there other logonscripts?
            It it possible that one of the mapped drives f, h, j, k, l, n is used also to copy files from, or run something from, during the user logon (\timeclock? perhaps?)
            The users are allowed to access the share on the server (windows server 2003?) with their own domain account?

            And this way?
            Code:
            @echo off
            
            net use f: /delete /Yes >Nul
            net use h: /delete /Yes >Nul
            net use j: /delete /Yes >Nul
            net use k: /delete /Yes >Nul
            net use l: /delete /Yes >Nul
            net use n: /delete /Yes >Nul
            
            ::wait ...
            (ping -n 2 127.0.0.1)>Nul
            
            net use f: \\xxx-fs1\Novell_SRV_BAK /Persistent:No
            net use h: \\xxx\apps /Persistent:No
            net use j: \\xxx-fs1\Users /Persistent:No
            net use k: \\xxx-fs1\Apps /Persistent:No
            net use l: \\xxx-fs1\admins /Persistent:No
            net use n: \\xxx-fs1\Timeclock /Persistent:No
            (Do not end the batch with 'exit')

            \Rems

            For testing - run the batch manually on one of the clients, after the user is logged on. For this testing only, add a last line to the batch: @Pause
            So you'll be able to see if there are errors.

            This posting is provided "AS IS" with no warranties, and confers no rights.

            __________________

            ** Remember to give credit where credit's due **
            and leave Reputation Points for meaningful posts

            Comment


            • #7
              Re: login.bat cmd window will not close after it runs

              Hello,

              Can I ask are all the drives mapping for you when this script runs? Perhaps one is failing?

              Also you have a mapping to "\\xxx-fs1\Novell_SRV_BAK", are you running a Novell environment? Have you tried "map" instead of net use if so? (Requires the Novell client to be installed.)


              Btw I believe Sgmunson also suggested putting a "start /b" at the beginning of your script
              I don't know anything about (you or your) computers.
              Research/test for yourself when listening to free advice.

              Comment

              Working...
              X