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

Author Topic: batch to open and close mapped drive  (Read 2230 times)

0 Members and 1 Guest are viewing this topic.

eagle13

  • Guest
batch to open and close mapped drive
« on: August 18, 2006, 02:32:50 AM »
Hi

I was wondering if I could get some help in creating a bat or cmd to perform a particualr function in Windows XP.
In a particular scenario I am working on, a server will backup files from network computers. But before that, I need a batch file to execute and check that the mapped drives on the server to client computers are active and available (as the backup will not work if the mapped drives auto disconnect)

So far I have worked out:
start L:\
will open the mapped drive L and show its folder contents (therefore verifying mapped drive has not disconnected and is ready) , but now how do I close the drive window?

In other words, what command would I use to now close the L drive window I opened with command 'start'?

uli_glueck

  • Guest
Re: batch to open and close mapped drive
« Reply #1 on: August 18, 2006, 02:38:46 AM »
To check if a drive is mapped (active) you can analyze the output of the "net use" command.
Parse it with a for loop.

uli

uli_glueck

  • Guest
Re: batch to open and close mapped drive
« Reply #2 on: August 18, 2006, 02:40:33 AM »
Quote
In other words, what command would I use to now close the L drive window I opened with command 'start'?


"exit" closes the window

uli


eagle13

  • Guest
Re: batch to open and close mapped drive
« Reply #3 on: August 18, 2006, 09:51:18 PM »
uli

both solutions sound interesting, my only problem is how to syntax your results
would you be able to help me construct the batch file code? I have really no idea how to do it
« Last Edit: August 18, 2006, 09:52:15 PM by eagle13 »