Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8819527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:22:57+00:00 2026-06-14T05:22:57+00:00

We had a script push out to map a new drive, but net use

  • 0

We had a script push out to map a new drive, but net use R: /Delete was not used so the drive is still there and there are incorrect mappings to the next available letter for hundreds of users. I need to delete all incorrect mappings and was hoping there was a batch script that would scan for a specific mapping and then pipe the drive letter.

Set Path = \\Drive\Folder
Set DriveLetter = ?Scan all mapped drives for %Path%?
Net Use %DriveLetter% /Delete

Looking to fill in the blanks here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:22:58+00:00Added an answer on June 14, 2026 at 5:22 am

    net use will show drive mappings (connected or not)

    example output:

    New connections will be remembered.
    
    
    Status       Local     Remote                    Network
    
    -------------------------------------------------------------------------------
    Disconnected Q:        \\Server1\Drive 
                                                     Microsoft Windows Network
    OK           S:        \\Server2\Drive2 
                                                     Microsoft Windows Network
    The command completed successfully.

    looking at this output, the 2nd column, gives us the drive letter, and the 3rd gives us the path. putting this into a for /f loop to check the path, and if it matches delete the drive letter in the 2nd part

    for /f "tokens=2,3" %%a in ('net use') do if .%%b==.\\Server\DriveCaseSensitive net use %%a /Delete
    

    This means that it will also detect and remove mappings if the drive has been mapped multiple times

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had developed a script, earlier I use to transfer it directly without any
Asp.net team had designed script manager such that only one instance existed per page(HttpHandler),
I have been trying to figure this out for several hours but have had
Alright, I recently wrote a ajax push script which had php on the backend
I had my script set up on old.example.com/?paypal_notify=1 . There were a few people
I had a script that needed the use of __file__ , and so I
I am trying to use Topsy for tracking some stats. I had a script
I had a script that was running locally, but it failed on Rally. The
Last night I had a script go a bit crazy and create a bunch
Say for example you had a shell script that utilises inotifywait in the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.