BAT - Script to Map Drives

SearchCtrl+K

Chat

Ctrl+J

Voice

Files

Tasks

Projects

History

Today

This Week

July

Add logic to change the link on my pictures, my music, my videos

@echo off

echo Mapping Synology NAS drives...

:: Map Document drive

net use F: \\192.168.1.20\Documents /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

 echo Successfully mapped Documents drive to F:

) else (

 echo Failed to map Documents drive

)

:: Map Video drive

net use V: \\192.168.1.20\Video /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

 echo Successfully mapped Video drive to M:

) else (

 echo Failed to map Video drive

)

:: Map Photos drive

net use P: \\192.168.1.20\Photo /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

 echo Successfully mapped Photos drive to P:

) else (

 echo Failed to map Photos drive

)

:: Map Music drive

net use M: \\192.168.1.20\Music /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

 echo Successfully mapped Music drive to U:

) else (

 echo Failed to map Music drive

)

echo Drive mapping complete.

::pause

3 / 3

Thought for 29s

@echo off

echo Mapping Synology NAS drives...

:: Map Document drive

net use F: \192.168.1.20\Documents /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

echo Successfully mapped Documents drive to F:

) else (

echo Failed to map Documents drive

)

:: Map Video drive

net use V: \192.168.1.20\Video /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

echo Successfully mapped Video drive to V:

) else (

echo Failed to map Video drive

)

:: Map Photos drive

net use P: \192.168.1.20\Photo /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

echo Successfully mapped Photos drive to P:

) else (

echo Failed to map Photos drive

)

:: Map Music drive

net use M: \192.168.1.20\Music /user:jehan0606 Password /persistent:yes

if %ERRORLEVEL% == 0 (

echo Successfully mapped Music drive to M:

) else (

echo Failed to map Music drive

)

echo Drive mapping complete.

echo Changing user shell folder locations...

:: Change Documents location

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_SZ /d "F:" /f

if %ERRORLEVEL% == 0 (

echo Successfully changed Documents location to F:

) else (

echo Failed to change Documents location

)

:: Change Videos location

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Video" /t REG_SZ /d "V:" /f

if %ERRORLEVEL% == 0 (

echo Successfully changed Videos location to V:

) else (

echo Failed to change Videos location

)

:: Change Pictures location

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_SZ /d "P:" /f

if %ERRORLEVEL% == 0 (

echo Successfully changed Pictures location to P:

) else (

echo Failed to change Pictures location

)

:: Change Music location

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Music" /t REG_SZ /d "M:" /f

if %ERRORLEVEL% == 0 (

echo Successfully changed Music location to M:

) else (

echo Failed to change Music location

)

echo Folder location changes complete.

echo Note: You may need to restart Explorer or log off and log back in for changes to take effect.

:: Optional: Restart Explorer

:: taskkill /im explorer.exe /f

:: start explorer.exe

::pause 

  