Alex Rivera | Logout

windows bat file: undo NET USE

Asked 2011-08-16T11:15:01.517
13

In a batch-file I use the following syntax to map a network drive:

NET USE N: \\someserver\somedirectory.

While this works fine, it also gives an error if the letter n is already used. Is it possible to suppress this error message?

Also, is there a way to unmap a network drive?

I imagine something like:

NET UNUSE N:

Edit
Report

1 Answer

0

The easiest is: IF NOT EXIST N:. NET USE N: \someserver\somedirectory

answered 2013-07-02T10:09:33.193

Your Answer