Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to - If user clicks EXIT then unmount (popd) network drive  (Read 3229 times)

0 Members and 1 Guest are viewing this topic.

mcolli00

    Topic Starter


    Greenhorn

    I have a batch file that mounts a drive and runs various scripts on a network drive. Once the scripts completes the drive automatically unmounts.  If the user clicks the exit button on the dos window I would like to unmount the drive.  Do you know how unmount a drive if the user exits the batch operation? Thanks MC


    IF EXIT popd \\mynetwork


    BumFacer



      Rookie

    • Its not the things they say, its what they whisper
      Re: How to - If user clicks EXIT then unmount (popd) network drive
      « Reply #1 on: April 21, 2009, 09:51:37 AM »
      Why don't you just run the batch file in the background so user can't exit it by closing the prompt? Or do I not understand the problem?

      macdad-



        Expert

        Thanked: 40
        Re: How to - If user clicks EXIT then unmount (popd) network drive
        « Reply #2 on: April 21, 2009, 11:09:52 AM »
        This is not possible if you mean "DOS" in Windows, since that is actually CMD.

        You can't unmount a drive in CMD.
        If you dont know DOS, you dont know Windows...

        Thats why Bill Gates created the Windows NT Family.

        mcolli00

          Topic Starter


          Greenhorn

          Re: How to - If user clicks EXIT then unmount (popd) network drive
          « Reply #3 on: April 21, 2009, 11:30:28 AM »
          I have the mounting and unmounting working fine. Users test the scripts so they are allowed the flexibility to kill a batch if needed.

          I just wanted to know if you can use

          if Exit then do something...

          macdad-



            Expert

            Thanked: 40
            Re: How to - If user clicks EXIT then unmount (popd) network drive
            « Reply #4 on: April 21, 2009, 12:12:04 PM »
            Oh i see what your using, Popd, haven't seen that in a while.

            And no you can't check to see if the batch file closes then do something, it's not possible in batch.
            If you dont know DOS, you dont know Windows...

            Thats why Bill Gates created the Windows NT Family.

            mcolli00

              Topic Starter


              Greenhorn

              Re: How to - If user clicks EXIT then unmount (popd) network drive
              « Reply #5 on: April 21, 2009, 12:29:43 PM »
              Alrighty thanks :-)

              devcom



                Apprentice

                Thanked: 37
                Re: How to - If user clicks EXIT then unmount (popd) network drive
                « Reply #6 on: April 21, 2009, 02:25:50 PM »
                you can compile somebatfile.bat to someexefile.exe wich will create subbatfile.bat. That subbatfile.bat will check if that compiled someexefile.exe is running or no  ;D
                Download: Choice.exe

                macdad-



                  Expert

                  Thanked: 40
                  Re: How to - If user clicks EXIT then unmount (popd) network drive
                  « Reply #7 on: April 21, 2009, 03:17:47 PM »
                  yes, but if he means run whatever commands on program termination then thats not possible.
                  If you dont know DOS, you dont know Windows...

                  Thats why Bill Gates created the Windows NT Family.