Map All Remote Drives

This short script will map a drive letter to all the admin shares to a remote computer. My plan was to use this script when I use RDP (Remote Desktop Protocol) to access a computer from home. I will run this script and map all my home computer hard drives to the work computer. Now I can transfer files between the two locations, without using tricks like emailing the file to myself.


@echo off
Set /p LocalComputer=[What is the name of the local computer you want to map drives to?]
cls
Echo This script will map a network drive to all active drives on the laptop "%LocalComputer%".
Echo.
Echo Please share any drives you would like to access before running the script.
echo To share the drive:
echo. Right-click the drive from 'My Computer'
echo. Select Sharing and Security
echo. Select Share this drive
echo. Enter a share name of the drive letter ending with a '$'.
echo. For example: T$
Echo.
Echo These drives are currently accessible:
for /R \\%LocalComputer%\ %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%a$ echo %%a$
echo.
echo Press CTRL+C to cancel this script
Pause
for /R \\%LocalComputer%\ %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%a$ net use * %%a$

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <blockquote> <center> <hr> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options