Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

I use around 3 pc with windows 7 and 8.1 and I wanted a common drive letter where store my data.

My home pc has 3 drivers and my data folder is stored in D:\Dati, in another pc the data is store in c:\personal and 3rd pc the data is stored in e:\mydata. What I needed was a common drive letter so I used subst.exe to "mount" a foldes as a drive.

 

SYNTAX

subst B: D:\Dati

 note: drive b: will be removed after a simple restart.

 

PERMAMENT

Using the registry you dont need to run subst. It will "mount" the drive specified at startup.

Save the following code in mydrive.reg and then run it. It will add an entry in your windows registry.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"B:"="\\??\\D:\\dati"

  

ON DEMAND

Copy and paste in the notepad and save it as bymanToggleDrive_B.cmd

@ECHO OFF
REM ...byman2017!
IF NOT EXIST B:\NUL SET ACTION=MOUNT
IF EXIST B:\NUL SET ACTION=UNMOUNT
CALL :REPORT

IF %ACTION%==UNMOUNT CALL :DISCONNECT 
IF %ACTION%==MOUNT CALL :CONNECT

CALL :REPORT
GOTO FINE

:CONNECT
ECHO.
ECHO mounting folder C:\byman to B: ...
ECHO.
SUBST B: C:\BYMAN
IF EXIST B:\NUL ECHO Drive B: mounted succesfully.
IF NOT EXIST B:\NUL ECHO ERROR: Drive B: DOES NOT MOUNTED
ECHO. 
IF NOT EXIST B:\NUL PAUSE
ECHO. 
EXIT /B

:DISCONNECT
ECHO.
ECHO ...unmounting Disk B: from C:\byman ...
ECHO.
SUBST B: /D
IF NOT EXIST B:\NUL ECHO Drive B: Unmounted succesfully.
IF EXIST B:\NUL ECHO ERROR: Drive B:  has NOT been unmounted
ECHO. 
IF EXIST B:\NUL ECHO PAUSE
EXIT /B

:REPORT
ECHO.
ECHO ****************************************
ECHO REPORT FOR DRIVE B: 
ECHO ****************************************
ECHO - Action: %ACTION%
ECHO.
IF EXIST B:\NUL ECHO - Drive B: Exists
IF NOT EXIST B:\NUL ECHO - Drive B: NOT Exists
ECHO.
ECHO - SUBST Report
ECHO.
SUBST
ECHO.
ECHO ****************************************
ECHO.
PAUSE
EXIT /B

:FINE

 

 

 

DISQUS - Leave your comments here